[Python-checkins] python/dist/src/Lib/test test_copy.py,1.3,1.4

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2003年2月06日 13:25:17 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv1908/test
Modified Files:
	test_copy.py 
Log Message:
Fix a bug in the way __getnewargs__ was handled.
Index: test_copy.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_copy.py	6 Feb 2003 19:53:22 -0000	1.3
--- test_copy.py	6 Feb 2003 21:25:12 -0000	1.4
***************
*** 455,458 ****
--- 455,476 ----
 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()

AltStyle によって変換されたページ (->オリジナル) /