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
6a69466f
Commit
6a69466f
authored
Apr 16, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backported tests from issue #20175.
parent
f4bbc535
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
Lib/test/test_fileio.py
Lib/test/test_fileio.py
+12
-3
Lib/test/test_io.py
Lib/test/test_io.py
+11
-0
No files found.
Lib/test/test_fileio.py
View file @
6a69466f
...
@@ -126,9 +126,9 @@ class AutoFileTests(unittest.TestCase):
...
@@ -126,9 +126,9 @@ class AutoFileTests(unittest.TestCase):
self
.
assertTrue
(
f
.
closed
)
self
.
assertTrue
(
f
.
closed
)
def
testMethods
(
self
):
def
testMethods
(
self
):
methods
=
[
'fileno'
,
'isatty'
,
'
read'
,
'readinto
'
,
methods
=
[
'fileno'
,
'isatty'
,
'
seekable'
,
'readable'
,
'writable
'
,
'
seek'
,
'tell'
,
'truncate'
,
'write'
,
'seekable
'
,
'
read'
,
'readall'
,
'readline'
,
'readlines
'
,
'
readable'
,
'writable
'
]
'
tell'
,
'truncate'
,
'flush
'
]
self
.
f
.
close
()
self
.
f
.
close
()
self
.
assertTrue
(
self
.
f
.
closed
)
self
.
assertTrue
(
self
.
f
.
closed
)
...
@@ -138,6 +138,15 @@ class AutoFileTests(unittest.TestCase):
...
@@ -138,6 +138,15 @@ class AutoFileTests(unittest.TestCase):
# should raise on closed file
# should raise on closed file
self
.
assertRaises
(
ValueError
,
method
)
self
.
assertRaises
(
ValueError
,
method
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
readinto
)
# XXX should be TypeError?
self
.
assertRaises
(
ValueError
,
self
.
f
.
readinto
,
bytearray
(
1
))
self
.
assertRaises
(
ValueError
,
self
.
f
.
seek
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
seek
,
0
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
write
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
write
,
b''
)
self
.
assertRaises
(
TypeError
,
self
.
f
.
writelines
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
writelines
,
b''
)
def
testOpendir
(
self
):
def
testOpendir
(
self
):
# Issue 3703: opening a directory should fill the errno
# Issue 3703: opening a directory should fill the errno
# Windows always returns "[Errno 13]: Permission denied
# Windows always returns "[Errno 13]: Permission denied
...
...
Lib/test/test_io.py
View file @
6a69466f
...
@@ -2087,6 +2087,17 @@ class TextIOWrapperTest(unittest.TestCase):
...
@@ -2087,6 +2087,17 @@ class TextIOWrapperTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
t
.
__init__
,
b
,
newline
=
42
)
self
.
assertRaises
(
TypeError
,
t
.
__init__
,
b
,
newline
=
42
)
self
.
assertRaises
(
ValueError
,
t
.
__init__
,
b
,
newline
=
'xyzzy'
)
self
.
assertRaises
(
ValueError
,
t
.
__init__
,
b
,
newline
=
'xyzzy'
)
def
test_uninitialized
(
self
):
t
=
self
.
TextIOWrapper
.
__new__
(
self
.
TextIOWrapper
)
del
t
t
=
self
.
TextIOWrapper
.
__new__
(
self
.
TextIOWrapper
)
self
.
assertRaises
(
Exception
,
repr
,
t
)
self
.
assertRaisesRegex
((
ValueError
,
AttributeError
),
'uninitialized|has no attribute'
,
t
.
read
,
0
)
t
.
__init__
(
self
.
MockRawIO
())
self
.
assertEqual
(
t
.
read
(
0
),
''
)
def
test_non_text_encoding_codecs_are_rejected
(
self
):
def
test_non_text_encoding_codecs_are_rejected
(
self
):
# Ensure the constructor complains if passed a codec that isn't
# Ensure the constructor complains if passed a codec that isn't
# marked as a text encoding
# marked as a text encoding
...
...
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