aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_marshal.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_marshal.py')
-rw-r--r--Lib/test/test_marshal.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index f87495bae2d..4467577b065 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -16,8 +16,8 @@ class IntTestCase(unittest.TestCase):
s = marshal.dumps(expected)
got = marshal.loads(s)
self.assertEqual(expected, got)
- marshal.dump(expected, file(test_support.TESTFN, "wb"))
- got = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(expected, open(test_support.TESTFN, "wb"))
+ got = marshal.load( open(test_support.TESTFN, "rb"))
self.assertEqual(expected, got)
n = n >> 1
os.unlink(test_support.TESTFN)
@@ -51,8 +51,8 @@ class IntTestCase(unittest.TestCase):
new = marshal.loads(marshal.dumps(b))
self.assertEqual(b, new)
self.assertEqual(type(b), type(new))
- marshal.dump(b, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(b, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(b, new)
self.assertEqual(type(b), type(new))
@@ -67,8 +67,8 @@ class FloatTestCase(unittest.TestCase):
s = marshal.dumps(f)
got = marshal.loads(s)
self.assertEqual(f, got)
- marshal.dump(f, file(test_support.TESTFN, "wb"))
- got = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(f, open(test_support.TESTFN, "wb"))
+ got = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(f, got)
n /= 123.4567
@@ -94,12 +94,12 @@ class FloatTestCase(unittest.TestCase):
got = marshal.loads(s)
self.assertEqual(f, got)
- marshal.dump(f, file(test_support.TESTFN, "wb"))
- got = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(f, open(test_support.TESTFN, "wb"))
+ got = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(f, got)
- marshal.dump(f, file(test_support.TESTFN, "wb"), 1)
- got = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(f, open(test_support.TESTFN, "wb"), 1)
+ got = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(f, got)
n *= 123.4567
os.unlink(test_support.TESTFN)
@@ -110,8 +110,8 @@ class StringTestCase(unittest.TestCase):
new = marshal.loads(marshal.dumps(s))
self.assertEqual(s, new)
self.assertEqual(type(s), type(new))
- marshal.dump(s, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(s, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(s, new)
self.assertEqual(type(s), type(new))
os.unlink(test_support.TESTFN)
@@ -121,8 +121,8 @@ class StringTestCase(unittest.TestCase):
new = marshal.loads(marshal.dumps(s))
self.assertEqual(s, new)
self.assertEqual(type(s), type(new))
- marshal.dump(s, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(s, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(s, new)
self.assertEqual(type(s), type(new))
os.unlink(test_support.TESTFN)
@@ -132,8 +132,8 @@ class StringTestCase(unittest.TestCase):
b = buffer(s)
new = marshal.loads(marshal.dumps(b))
self.assertEqual(s, new)
- marshal.dump(b, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(b, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(s, new)
os.unlink(test_support.TESTFN)
@@ -161,8 +161,8 @@ class ContainerTestCase(unittest.TestCase):
def test_dict(self):
new = marshal.loads(marshal.dumps(self.d))
self.assertEqual(self.d, new)
- marshal.dump(self.d, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(self.d, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(self.d, new)
os.unlink(test_support.TESTFN)
@@ -170,8 +170,8 @@ class ContainerTestCase(unittest.TestCase):
lst = self.d.items()
new = marshal.loads(marshal.dumps(lst))
self.assertEqual(lst, new)
- marshal.dump(lst, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(lst, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(lst, new)
os.unlink(test_support.TESTFN)
@@ -179,8 +179,8 @@ class ContainerTestCase(unittest.TestCase):
t = tuple(self.d.keys())
new = marshal.loads(marshal.dumps(t))
self.assertEqual(t, new)
- marshal.dump(t, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(t, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(t, new)
os.unlink(test_support.TESTFN)
@@ -191,8 +191,8 @@ class ContainerTestCase(unittest.TestCase):
self.assertEqual(t, new)
self.assert_(isinstance(new, constructor))
self.assertNotEqual(id(t), id(new))
- marshal.dump(t, file(test_support.TESTFN, "wb"))
- new = marshal.load(file(test_support.TESTFN, "rb"))
+ marshal.dump(t, open(test_support.TESTFN, "wb"))
+ new = marshal.load(open(test_support.TESTFN, "rb"))
self.assertEqual(t, new)
os.unlink(test_support.TESTFN)