]> granicus.if.org Git - python/commitdiff
Add a test for Context.copy().
authorRaymond Hettinger <python@rcn.com>
Sun, 8 Aug 2004 20:17:45 +0000 (20:17 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 8 Aug 2004 20:17:45 +0000 (20:17 +0000)
Lib/test/test_decimal.py

index 0a23808f5f7f7bddbc198a5d6cd9f0b680717cf9..a32caed61708e3e35233722ebf25bc7fec7265b9 100644 (file)
@@ -1056,6 +1056,14 @@ class ContextAPItests(unittest.TestCase):
         self.assert_(Decimal(10) in ['a', 1.0, Decimal(10), (1,2), {}])
         self.assert_(Decimal(10) not in ['a', 1.0, (1,2), {}])
 
+    def test_copy(self):
+        # All copies should be deep
+        c = Context()
+        d = c.copy()
+        self.assertNotEqual(id(c), id(d))
+        self.assertNotEqual(id(c.flags), id(d.flags))
+        self.assertNotEqual(id(c.traps), id(d.traps))
+
 def test_main(arith=False, verbose=None):
     """ Execute the tests.