summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_marshal.py
diff options
context:
space:
mode:
authorAlex Martelli <aleaxit@gmail.com>2006-08-24 02:58:11 (GMT)
committerAlex Martelli <aleaxit@gmail.com>2006-08-24 02:58:11 (GMT)
commit01c77c66289f8e9c8d15b8da623fae4014ec2edb (patch)
treef719c69719857899da42d2af8ceb48824cf4fe0d /Lib/test/test_marshal.py
parentb5d47efe92fd12cde1de6a473108ef48238a43cc (diff)
downloadcpython-01c77c66289f8e9c8d15b8da623fae4014ec2edb.zip
cpython-01c77c66289f8e9c8d15b8da623fae4014ec2edb.tar.gz
cpython-01c77c66289f8e9c8d15b8da623fae4014ec2edb.tar.bz2
Anna Ravenscroft identified many occurrences of "file" used to open a file
in the stdlib and changed each of them to use "open" instead. At this time there are no other known occurrences that can be safely changed (in Lib and all subdirectories thereof).
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 f87495b..4467577 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)