def test_copy(self): """Test copy method""" mat = np.eye(4) orig = SuperOp(mat) cpy = orig.copy() cpy._data[0, 0] = 0.0 self.assertFalse(cpy == orig)
def test_copy(self): """Test copy method""" mat = np.eye(4) with self.subTest("Deep copy"): orig = SuperOp(mat) cpy = orig.copy() cpy._data[0, 0] = 0.0 self.assertFalse(cpy == orig) with self.subTest("Shallow copy"): orig = SuperOp(mat) clone = copy.copy(orig) clone._data[0, 0] = 0.0 self.assertTrue(clone == orig)