Implement #7944. Use `with` throughout the test suite.

This commit is contained in:
Brian Curtin 2010-10-13 02:40:26 +00:00
parent 5acec04db5
commit 2c3563f782
1 changed files with 2 additions and 8 deletions

View File

@ -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)