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
7eb65847
Commit
7eb65847
authored
Nov 07, 2011
by
Brian Curtin
Browse files
Options
Browse Files
Download
Plain Diff
branch merge.
parents
569b4943
e0912db2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
Lib/test/test_pep277.py
Lib/test/test_pep277.py
+12
-7
No files found.
Lib/test/test_pep277.py
View file @
7eb65847
...
@@ -96,9 +96,10 @@ class UnicodeFileTests(unittest.TestCase):
...
@@ -96,9 +96,10 @@ class UnicodeFileTests(unittest.TestCase):
with
self
.
assertRaises
(
expected_exception
)
as
c
:
with
self
.
assertRaises
(
expected_exception
)
as
c
:
fn
(
filename
)
fn
(
filename
)
exc_filename
=
c
.
exception
.
filename
exc_filename
=
c
.
exception
.
filename
# the "filename" exception attribute may be encoded
# listdir may append a wildcard to the filename
if
isinstance
(
exc_filename
,
bytes
):
if
fn
is
os
.
listdir
and
sys
.
platform
==
'win32'
:
filename
=
filename
.
encode
(
sys
.
getfilesystemencoding
())
exc_filename
,
_
,
wildcard
=
exc_filename
.
rpartition
(
os
.
sep
)
self
.
assertEqual
(
wildcard
,
r'*.*'
)
if
check_filename
:
if
check_filename
:
self
.
assertEqual
(
exc_filename
,
filename
,
"Function '%s(%a) failed "
self
.
assertEqual
(
exc_filename
,
filename
,
"Function '%s(%a) failed "
"with bad filename in the exception: %a"
%
"with bad filename in the exception: %a"
%
...
@@ -113,8 +114,12 @@ class UnicodeFileTests(unittest.TestCase):
...
@@ -113,8 +114,12 @@ class UnicodeFileTests(unittest.TestCase):
self
.
_apply_failure
(
os
.
chdir
,
name
)
self
.
_apply_failure
(
os
.
chdir
,
name
)
self
.
_apply_failure
(
os
.
rmdir
,
name
)
self
.
_apply_failure
(
os
.
rmdir
,
name
)
self
.
_apply_failure
(
os
.
remove
,
name
)
self
.
_apply_failure
(
os
.
remove
,
name
)
# listdir may append a wildcard to the filename, so dont check
self
.
_apply_failure
(
os
.
listdir
,
name
)
self
.
_apply_failure
(
os
.
listdir
,
name
,
check_filename
=
False
)
if
sys
.
platform
==
'win32'
:
_listdir_failure
=
FileNotFoundError
else
:
_listdir_failure
=
NotADirectoryError
def
test_open
(
self
):
def
test_open
(
self
):
for
name
in
self
.
files
:
for
name
in
self
.
files
:
...
@@ -122,7 +127,7 @@ class UnicodeFileTests(unittest.TestCase):
...
@@ -122,7 +127,7 @@ class UnicodeFileTests(unittest.TestCase):
f
.
write
((
name
+
'
\
n
'
).
encode
(
"utf-8"
))
f
.
write
((
name
+
'
\
n
'
).
encode
(
"utf-8"
))
f
.
close
()
f
.
close
()
os
.
stat
(
name
)
os
.
stat
(
name
)
self
.
_apply_failure
(
os
.
listdir
,
name
,
NotADirectoryError
)
self
.
_apply_failure
(
os
.
listdir
,
name
,
self
.
_listdir_failure
)
# Skip the test on darwin, because darwin does normalize the filename to
# Skip the test on darwin, because darwin does normalize the filename to
# NFD (a variant of Unicode NFD form). Normalize the filename to NFC, NFKC,
# NFD (a variant of Unicode NFD form). Normalize the filename to NFC, NFKC,
...
@@ -142,7 +147,7 @@ class UnicodeFileTests(unittest.TestCase):
...
@@ -142,7 +147,7 @@ class UnicodeFileTests(unittest.TestCase):
self
.
_apply_failure
(
os
.
rmdir
,
name
)
self
.
_apply_failure
(
os
.
rmdir
,
name
)
self
.
_apply_failure
(
os
.
remove
,
name
)
self
.
_apply_failure
(
os
.
remove
,
name
)
# listdir may append a wildcard to the filename, so dont check
# listdir may append a wildcard to the filename, so dont check
self
.
_apply_failure
(
os
.
listdir
,
name
,
check_filename
=
False
)
self
.
_apply_failure
(
os
.
listdir
,
name
)
# Skip the test on darwin, because darwin uses a normalization different
# Skip the test on darwin, because darwin uses a normalization different
# than Python NFD normalization: filenames are different even if we use
# than Python NFD normalization: filenames are different even if we use
...
...
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