[Python-checkins] python/dist/src/Lib/test test_marshal.py,1.7,1.8

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Tue Jan 11 04:03:40 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1421/Lib/test

Modified Files:
	test_marshal.py 
Log Message:
SF 1098985:  set objects cannot be marshalled



Index: test_marshal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_marshal.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- test_marshal.py	20 Dec 2004 12:25:56 -0000	1.7
+++ test_marshal.py	11 Jan 2005 03:03:06 -0000	1.8
@@ -170,6 +170,18 @@
         self.assertEqual(t, new)
         os.unlink(test_support.TESTFN)
 
+    def test_sets(self):
+        for constructor in (set, frozenset):
+            t = constructor(self.d.keys())
+            new = marshal.loads(marshal.dumps(t))
+            self.assertEqual(t, new)
+            self.assert_(isinstance(new, constructor))
+            self.assertNotEqual(id(t), id(new))
+            marshal.dump(t, file(test_support.TESTFN, "wb"))
+            marshal.load(file(test_support.TESTFN, "rb"))
+            self.assertEqual(t, new)
+            os.unlink(test_support.TESTFN)
+
 class BugsTestCase(unittest.TestCase):
     def test_bug_5888452(self):
         # Simple-minded check for SF 588452: Debug build crashes



More information about the Python-checkins mailing list