summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-12-19 16:58:54 (GMT)
committerGuido van Rossum <guido@python.org>2001-12-19 16:58:54 (GMT)
commit04a866170dcad6a4e806fedca0d5e38ebe11867b (patch)
tree838dc143e30113279e6f1cfb7dabda5755d67fff /Lib/test/pickletester.py
parentf83142910bdb0556e3d561e78b62f5b0a453dfda (diff)
downloadcpython-04a866170dcad6a4e806fedca0d5e38ebe11867b.zip
cpython-04a866170dcad6a4e806fedca0d5e38ebe11867b.tar.gz
cpython-04a866170dcad6a4e806fedca0d5e38ebe11867b.tar.bz2
Add test for pickling new-style class with custom metaclass.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 71640db..1b58edb 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -24,6 +24,12 @@ class initarg(C):
def __getinitargs__(self):
return self.a, self.b
+class metaclass(type):
+ pass
+
+class use_metaclass(object):
+ __metaclass__ = metaclass
+
# break into multiple strings to avoid confusing font-lock-mode
DATA = """(lp1
I0
@@ -236,6 +242,12 @@ class AbstractPickleTests(unittest.TestCase):
def test_getinitargs(self):
pass
+ def test_metaclass(self):
+ a = use_metaclass()
+ s = self.dumps(a)
+ b = self.loads(s)
+ self.assertEqual(a.__class__, b.__class__)
+
class AbstractPickleModuleTests(unittest.TestCase):
def test_dump_closed_file(self):