[Python-checkins] r85402 - python/branches/py3k/Lib/test/test_marshal.py

brian.curtin python-checkins at python.org
Wed Oct 13 04:40:26 CEST 2010


Author: brian.curtin
Date: Wed Oct 13 04:40:26 2010
New Revision: 85402
Log:
Implement #7944. Use `with` throughout the test suite.
Modified:
 python/branches/py3k/Lib/test/test_marshal.py
Modified: python/branches/py3k/Lib/test/test_marshal.py
==============================================================================
--- python/branches/py3k/Lib/test/test_marshal.py	(original)
+++ python/branches/py3k/Lib/test/test_marshal.py	Wed Oct 13 04:40:26 2010
@@ -11,16 +11,10 @@
 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)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /