mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
SF 1062353: set pickling problems
Support automatic pickling of dictionaries in instance of set subclasses.
This commit is contained in:
parent
f8c075cefc
commit
15056a5202
2 changed files with 18 additions and 5 deletions
|
@ -175,9 +175,15 @@ class TestJointOps(unittest.TestCase):
|
|||
self.failIf(set('cbs').issuperset('a'))
|
||||
|
||||
def test_pickling(self):
|
||||
p = pickle.dumps(self.s)
|
||||
dup = pickle.loads(p)
|
||||
self.assertEqual(self.s, dup, "%s != %s" % (self.s, dup))
|
||||
for i in (0, 1, 2):
|
||||
p = pickle.dumps(self.s, i)
|
||||
dup = pickle.loads(p)
|
||||
self.assertEqual(self.s, dup, "%s != %s" % (self.s, dup))
|
||||
if type(self.s) not in (set, frozenset):
|
||||
self.s.x = 10
|
||||
p = pickle.dumps(self.s)
|
||||
dup = pickle.loads(p)
|
||||
self.assertEqual(self.s.x, dup.x)
|
||||
|
||||
def test_deepcopy(self):
|
||||
class Tracer:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue