Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
afbf90c9
Commit
afbf90c9
authored
Oct 06, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16025: Minor corrections to the zipfile documentation.
Patch by Serhiy Storchaka.
parent
cbd449b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
9 deletions
+31
-9
Doc/library/zipfile.rst
Doc/library/zipfile.rst
+9
-9
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+22
-0
No files found.
Doc/library/zipfile.rst
View file @
afbf90c9
...
@@ -61,7 +61,7 @@ The module defines the following items:
...
@@ -61,7 +61,7 @@ The module defines the following items:
..
class
::
ZipInfo
(
filename
=
'NoName'
,
date_time
=(
1980
,
1
,
1
,
0
,
0
,
0
))
..
class
::
ZipInfo
(
filename
=
'NoName'
,
date_time
=(
1980
,
1
,
1
,
0
,
0
,
0
))
Class
used
to
represent
information
about
a
member
of
an
archive
.
Instances
Class
used
to
represent
information
about
a
member
of
an
archive
.
Instances
of
this
class
are
returned
by
the
:
meth
:`
getinfo
`
and
:
meth
:`
infolist
`
of
this
class
are
returned
by
the
:
meth
:`
.
getinfo
`
and
:
meth
:`.
infolist
`
methods
of
:
class
:`
ZipFile
`
objects
.
Most
users
of
the
:
mod
:`
zipfile
`
module
methods
of
:
class
:`
ZipFile
`
objects
.
Most
users
of
the
:
mod
:`
zipfile
`
module
will
not
need
to
create
these
,
but
only
use
those
created
by
this
will
not
need
to
create
these
,
but
only
use
those
created
by
this
module
.
*
filename
*
should
be
the
full
name
of
the
archive
member
,
and
module
.
*
filename
*
should
be
the
full
name
of
the
archive
member
,
and
...
@@ -87,7 +87,7 @@ The module defines the following items:
...
@@ -87,7 +87,7 @@ The module defines the following items:
..
data
::
ZIP_DEFLATED
..
data
::
ZIP_DEFLATED
The
numeric
constant
for
the
usual
ZIP
compression
method
.
This
requires
the
The
numeric
constant
for
the
usual
ZIP
compression
method
.
This
requires
the
zlib
module
.
No
other
compression
methods
are
currently
supported
.
:
mod
:`
zlib
`
module
.
No
other
compression
methods
are
currently
supported
.
..
seealso
::
..
seealso
::
...
@@ -130,7 +130,7 @@ ZipFile Objects
...
@@ -130,7 +130,7 @@ ZipFile Objects
these
extensions
.
these
extensions
.
If
the
file
is
created
with
mode
``
'a'
``
or
``
'w'
``
and
then
If
the
file
is
created
with
mode
``
'a'
``
or
``
'w'
``
and
then
:
meth
:`
close
`\
d
without
adding
any
files
to
the
archive
,
the
appropriate
:
meth
:`
close
d
<
close
>`
without
adding
any
files
to
the
archive
,
the
appropriate
ZIP
structures
for
an
empty
archive
will
be
written
to
the
file
.
ZIP
structures
for
an
empty
archive
will
be
written
to
the
file
.
ZipFile
is
also
a
context
manager
and
therefore
supports
the
ZipFile
is
also
a
context
manager
and
therefore
supports
the
...
@@ -179,7 +179,7 @@ ZipFile Objects
...
@@ -179,7 +179,7 @@ ZipFile Objects
*mode* parameter, if included, must be one of the following: ``'
r
'`` (the
*mode* parameter, if included, must be one of the following: ``'
r
'`` (the
default), ``'
U
'``, or ``'
rU
'``. Choosing ``'
U
'`` or ``'
rU
'`` will enable
default), ``'
U
'``, or ``'
rU
'``. Choosing ``'
U
'`` or ``'
rU
'`` will enable
:term:`universal newlines` support in the read-only object. *pwd* is the
:term:`universal newlines` support in the read-only object. *pwd* is the
password used for encrypted files. Calling :meth:`open` on a closed
password used for encrypted files. Calling :meth:`
.
open` on a closed
ZipFile will raise a :exc:`RuntimeError`.
ZipFile will raise a :exc:`RuntimeError`.
.. note::
.. note::
...
@@ -201,7 +201,7 @@ ZipFile Objects
...
@@ -201,7 +201,7 @@ ZipFile Objects
..
note
::
..
note
::
The
:
meth
:`
open
`,
:
meth
:`
read
`
and
:
meth
:`
extract
`
methods
can
take
a
filename
The
:
meth
:`
.
open
`,
:
meth
:`
read
`
and
:
meth
:`
extract
`
methods
can
take
a
filename
or
a
:
class
:`
ZipInfo
`
object
.
You
will
appreciate
this
when
trying
to
read
a
or
a
:
class
:`
ZipInfo
`
object
.
You
will
appreciate
this
when
trying
to
read
a
ZIP
file
that
contains
members
with
duplicate
names
.
ZIP
file
that
contains
members
with
duplicate
names
.
...
@@ -307,7 +307,7 @@ ZipFile Objects
...
@@ -307,7 +307,7 @@ ZipFile Objects
:class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`.
:class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`.
.. versionchanged:: 3.2
.. versionchanged:: 3.2
The *compress
ion
_type* argument.
The *compress_type* argument.
The following data attributes are also available:
The following data attributes are also available:
...
@@ -323,7 +323,7 @@ The following data attributes are also available:
...
@@ -323,7 +323,7 @@ The following data attributes are also available:
The comment text associated with the ZIP file. If assigning a comment to a
The comment text associated with the ZIP file. If assigning a comment to a
:class:`ZipFile` instance created with mode '
a
' or '
w
', this should be a
:class:`ZipFile` instance created with mode '
a
' or '
w
', this should be a
string no longer than 65535 bytes. Comments longer than this will be
string no longer than 65535 bytes. Comments longer than this will be
truncated in the written archive when :meth:`
ZipFile.
close` is called.
truncated in the written archive when :meth:`close` is called.
.. _pyzipfile-objects:
.. _pyzipfile-objects:
...
@@ -379,8 +379,8 @@ The :class:`PyZipFile` constructor takes the same parameters as the
...
@@ -379,8 +379,8 @@ The :class:`PyZipFile` constructor takes the same parameters as the
ZipInfo Objects
ZipInfo Objects
---------------
---------------
Instances of the :class:`ZipInfo` class are returned by the :meth:`getinfo` and
Instances of the :class:`ZipInfo` class are returned by the :meth:`
.
getinfo` and
:meth:`infolist` methods of :class:`ZipFile` objects. Each object stores
:meth:`
.
infolist` methods of :class:`ZipFile` objects. Each object stores
information about a single member of the ZIP archive.
information about a single member of the ZIP archive.
Instances have the following attributes:
Instances have the following attributes:
...
...
Lib/test/test_subprocess.py
View file @
afbf90c9
...
@@ -165,6 +165,28 @@ class ProcessTestCase(BaseTestCase):
...
@@ -165,6 +165,28 @@ class ProcessTestCase(BaseTestCase):
p
.
wait
()
p
.
wait
()
self
.
assertEqual
(
p
.
stderr
,
None
)
self
.
assertEqual
(
p
.
stderr
,
None
)
@
unittest
.
skipIf
(
mswindows
,
"path not included in Windows message"
)
def
test_path_in_arg_not_found_message
(
self
):
# Check that the error message displays the path not found when
# args[0] is not found.
self
.
assertRaisesRegex
(
FileNotFoundError
,
"notfound_blahblah"
,
subprocess
.
Popen
,
[
"notfound_blahblah"
])
@
unittest
.
skipIf
(
mswindows
,
"path not displayed in Windows message"
)
def
test_path_in_executable_not_found_message
(
self
):
# Check that the error message displays the executable argument (and
# not args[0]) when the executable argument is not found
# (issue #16114).
# We call sys.exit() inside the code to prevent the test runner
# from hanging if the test fails and finds python.
self
.
assertRaisesRegex
(
FileNotFoundError
,
"notfound_blahblah"
,
subprocess
.
Popen
,
[
sys
.
executable
,
"-c"
,
"import sys; sys.exit(47)"
],
executable
=
"notfound_blahblah"
)
self
.
assertRaisesRegex
(
FileNotFoundError
,
"exenotfound_blahblah"
,
subprocess
.
Popen
,
[
"argnotfound_blahblah"
],
executable
=
"exenotfound_blahblah"
)
# For use in the test_cwd* tests below.
# For use in the test_cwd* tests below.
def
_normalize_cwd
(
self
,
cwd
):
def
_normalize_cwd
(
self
,
cwd
):
# Normalize an expected cwd (for Tru64 support).
# Normalize an expected cwd (for Tru64 support).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment