Store the functions in the _type_equality_funcs as wrapped objects that are deep copyable.

This allows for the deep copying of TestCase instances.

Issue 5660
This commit is contained in:
Michael Foord 2009-04-02 05:51:54 +00:00
parent 7152f6d915
commit e2942d073d
2 changed files with 27 additions and 4 deletions

View file

@ -11,6 +11,7 @@ from test import test_support
import unittest
from unittest import TestCase
import types
from copy import deepcopy
### Support code
################################################################
@ -2688,6 +2689,17 @@ test case
self.failUnlessRaises(TypeError, lambda _: 3.14 + u'spam')
self.failIf(False)
def testDeepcopy(self):
# Issue: 5660
class TestableTest(TestCase):
def testNothing(self):
pass
test = TestableTest('testNothing')
# This shouldn't blow up
deepcopy(test)
class Test_TestSkipping(TestCase):