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
dfe21074
Commit
dfe21074
authored
Aug 03, 2010
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deprecation warnings in test_file.py
parent
cd37dd8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
Lib/test/test_file.py
Lib/test/test_file.py
+9
-5
No files found.
Lib/test/test_file.py
View file @
dfe21074
...
...
@@ -34,13 +34,16 @@ class AutoFileTests(unittest.TestCase):
def
testAttributes
(
self
):
# verify expected attributes exist
f
=
self
.
f
softspace
=
f
.
softspace
f
.
name
# merely shouldn't blow up
f
.
mode
# ditto
f
.
closed
# ditto
# verify softspace is writable
f
.
softspace
=
softspace
# merely shouldn't blow up
with
test_support
.
_check_py3k_warnings
(
(
'file.softspace not supported in 3.x'
,
DeprecationWarning
)):
softspace
=
f
.
softspace
# verify softspace is writable
f
.
softspace
=
softspace
# merely shouldn't blow up
# verify the others aren't
for
attr
in
'name'
,
'mode'
,
'closed'
:
...
...
@@ -111,7 +114,8 @@ class AutoFileTests(unittest.TestCase):
for
methodname
in
methods
:
method
=
getattr
(
self
.
f
,
methodname
)
# should raise on closed file
self
.
assertRaises
(
ValueError
,
method
)
with
test_support
.
_check_py3k_warnings
(
quiet
=
True
):
self
.
assertRaises
(
ValueError
,
method
)
self
.
assertRaises
(
ValueError
,
self
.
f
.
writelines
,
[])
# file is closed, __exit__ shouldn't do anything
...
...
@@ -218,7 +222,7 @@ class OtherFileTests(unittest.TestCase):
try
:
f
=
open
(
TESTFN
,
bad_mode
)
except
ValueError
,
msg
:
if
msg
[
0
]
!=
0
:
if
msg
.
args
[
0
]
!=
0
:
s
=
str
(
msg
)
if
TESTFN
in
s
or
bad_mode
not
in
s
:
self
.
fail
(
"bad error message for invalid mode: %s"
%
s
)
...
...
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