summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_marshal.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-01-11 03:03:27 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-01-11 03:03:27 (GMT)
commita422c34b705cad292cc0c30998ae0e45006de0d6 (patch)
treefefbc7795e8cf1a91999be3619410817c838770f /Lib/test/test_marshal.py
parent7130ff5eb9ad0edf5cf0c8811ceea155f11194eb (diff)
downloadcpython-a422c34b705cad292cc0c30998ae0e45006de0d6.zip
cpython-a422c34b705cad292cc0c30998ae0e45006de0d6.tar.gz
cpython-a422c34b705cad292cc0c30998ae0e45006de0d6.tar.bz2
SF 1098985: set objects cannot be marshalled
Diffstat (limited to 'Lib/test/test_marshal.py')
-rw-r--r--Lib/test/test_marshal.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_marshal.py b/Lib/test/test_marshal.py
index 5c1a3f3..9901a3c 100644
--- a/Lib/test/test_marshal.py
+++ b/Lib/test/test_marshal.py
@@ -170,6 +170,18 @@ class ContainerTestCase(unittest.TestCase):
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