mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Add getstate and setstate implementation to concrete set classes.
This commit is contained in:
parent
66abcee948
commit
cd58b8f532
2 changed files with 21 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue