mirror of https://github.com/python/cpython
Add test for pickling new-style class with custom metaclass.
This commit is contained in:
parent
f83142910b
commit
04a866170d
|
@ -24,6 +24,12 @@ class initarg(C):
|
||||||
def __getinitargs__(self):
|
def __getinitargs__(self):
|
||||||
return self.a, self.b
|
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
|
# break into multiple strings to avoid confusing font-lock-mode
|
||||||
DATA = """(lp1
|
DATA = """(lp1
|
||||||
I0
|
I0
|
||||||
|
@ -236,6 +242,12 @@ class AbstractPickleTests(unittest.TestCase):
|
||||||
def test_getinitargs(self):
|
def test_getinitargs(self):
|
||||||
pass
|
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):
|
class AbstractPickleModuleTests(unittest.TestCase):
|
||||||
|
|
||||||
def test_dump_closed_file(self):
|
def test_dump_closed_file(self):
|
||||||
|
|
Loading…
Reference in New Issue