Add getstate and setstate implementation to concrete set classes.

This commit is contained in:
Jeremy Hylton 2002-11-13 19:34:26 +00:00
parent 66abcee948
commit cd58b8f532
2 changed files with 21 additions and 1 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
import unittest, operator, copy
import unittest, operator, copy, pickle
from sets import Set, ImmutableSet
from test import test_support
@ -74,6 +74,14 @@ class TestBasicOps(unittest.TestCase):
for v in self.set:
self.assert_(v in self.values)
def test_pickling(self):
p = pickle.dumps(self.set)
print repr(p)
copy = pickle.loads(p)
repr(copy)
self.assertEqual(self.set, copy,
"%s != %s" % (self.set, copy))
#------------------------------------------------------------------------------
class TestBasicOpsEmpty(TestBasicOps):