summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-10-13 02:40:26 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-10-13 02:40:26 (GMT)
commit2c3563f7827ad6d6a726fabd2352597924af1e78 (patch)
tree3a8d4ab3eef690e7c790ee2e9e1fb5fc1566ae36 /Lib
parent5acec04db5528ba51c606db33a852d6bd5810aed (diff)
downloadcpython-2c3563f7827ad6d6a726fabd2352597924af1e78.zip
cpython-2c3563f7827ad6d6a726fabd2352597924af1e78.tar.gz
cpython-2c3563f7827ad6d6a726fabd2352597924af1e78.tar.bz2
Implement #7944. Use `with` throughout the test suite.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_marshal.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index 9de0165..a79a357 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -11,16 +11,10 @@ class HelperMixin:
new = marshal.loads(marshal.dumps(sample, *extra))
self.assertEqual(sample, new)
try:
- f = open(support.TESTFN, "wb")
- try:
+ with open(support.TESTFN, "wb") as f:
marshal.dump(sample, f, *extra)
- finally:
- f.close()
- f = open(support.TESTFN, "rb")
- try:
+ with open(support.TESTFN, "rb") as f:
new = marshal.load(f)
- finally:
- f.close()
self.assertEqual(sample, new)
finally:
support.unlink(support.TESTFN)