diff options
author | Raymond Hettinger <python@rcn.com> | 2004-11-09 07:25:31 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-11-09 07:25:31 (GMT) |
commit | 15056a5202c89846d75006d66541d5a634ac79b5 (patch) | |
tree | dc4a2a104e7e73d8ae4965ff5d511f30902b712a /Lib/test/test_set.py | |
parent | f8c075cefcd737618ea25924f62e07dc003fa0db (diff) | |
download | cpython-15056a5202c89846d75006d66541d5a634ac79b5.zip cpython-15056a5202c89846d75006d66541d5a634ac79b5.tar.gz cpython-15056a5202c89846d75006d66541d5a634ac79b5.tar.bz2 |
SF 1062353: set pickling problems
Support automatic pickling of dictionaries in instance of set subclasses.
Diffstat (limited to 'Lib/test/test_set.py')
-rw-r--r-- | Lib/test/test_set.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index aab0c57..900d8e4 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -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: |