diff options
Diffstat (limited to 'Lib/test/test_marshal.py')
-rw-r--r-- | Lib/test/test_marshal.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py index 5e1cdd5..81cf598 100644 --- a/Lib/test/test_marshal.py +++ b/Lib/test/test_marshal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from test import support import marshal @@ -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) |