summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/pickletester.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index cc464a9..36b3702 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -324,12 +324,29 @@ class AbstractPickleTests(unittest.TestCase):
## print
## pickletools.dis(s)
+ def test_newobj_list_slots(self):
+ x = SlotList([1, 2, 3])
+ x.foo = 42
+ x.bar = "hello"
+ s = self.dumps(x, 2)
+ y = self.loads(s)
+ self.assertEqual(list(x), list(y))
+ self.assertEqual(x.__dict__, y.__dict__)
+ self.assertEqual(x.foo, y.foo)
+ self.assertEqual(x.bar, y.bar)
+## import pickletools
+## print
+## pickletools.dis(s)
+
class MyTuple(tuple):
pass
class MyList(list):
pass
+class SlotList(MyList):
+ __slots__ = ["foo"]
+
class AbstractPickleModuleTests(unittest.TestCase):
def test_dump_closed_file(self):