Пример #1
0
 def test_copy(self):
     """Test copy method"""
     mat = np.eye(4)
     orig = Choi(mat)
     cpy = orig.copy()
     cpy._data[0, 0] = 0.0
     self.assertFalse(cpy == orig)
Пример #2
0
 def test_copy(self):
     """Test copy method"""
     mat = np.eye(2)
     with self.subTest("Deep copy"):
         orig = Choi(mat)
         cpy = orig.copy()
         cpy._data[0, 0] = 0.0
         self.assertFalse(cpy == orig)
     with self.subTest("Shallow copy"):
         orig = Choi(mat)
         clone = copy.copy(orig)
         clone._data[0, 0] = 0.0
         self.assertTrue(clone == orig)