summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-02-06 21:25:12 (GMT)
committerGuido van Rossum <guido@python.org>2003-02-06 21:25:12 (GMT)
commit85233bf74679a5dae4365507526789883a3c1158 (patch)
treebf180d690fe03682e3c09b1132d4a3dca54ce874 /Lib/test
parent694d9b354195ac3bf361b33601ed77e5b02e4fa7 (diff)
downloadcpython-85233bf74679a5dae4365507526789883a3c1158.zip
cpython-85233bf74679a5dae4365507526789883a3c1158.tar.gz
cpython-85233bf74679a5dae4365507526789883a3c1158.tar.bz2
Fix a bug in the way __getnewargs__ was handled.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_copy.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index 846e675..c97d54d 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -454,6 +454,24 @@ class TestCopy(unittest.TestCase):
self.assert_(x[0] is not y[0])
self.assert_(x.foo is not y.foo)
+ def test_copy_tuple_subclass(self):
+ class C(tuple):
+ pass
+ x = C([1, 2, 3])
+ self.assertEqual(tuple(x), (1, 2, 3))
+ y = copy.copy(x)
+ self.assertEqual(tuple(y), (1, 2, 3))
+
+ def test_deepcopy_tuple_subclass(self):
+ class C(tuple):
+ pass
+ x = C([[1, 2], 3])
+ self.assertEqual(tuple(x), ([1, 2], 3))
+ y = copy.deepcopy(x)
+ self.assertEqual(tuple(y), ([1, 2], 3))
+ self.assert_(x is not y)
+ self.assert_(x[0] is not y[0])
+
def test_main():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCopy))