From 57379f6f5fe24ac30fa31bc678f43f8cc104de7b Mon Sep 17 00:00:00 2001 From: Riley Murray Date: Mon, 13 Nov 2023 11:23:24 -0500 Subject: [PATCH] fix inheritance issue --- test/unit/modelmembers/test_operation.py | 44 ++---------------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/test/unit/modelmembers/test_operation.py b/test/unit/modelmembers/test_operation.py index b00280e9f..728399fd5 100644 --- a/test/unit/modelmembers/test_operation.py +++ b/test/unit/modelmembers/test_operation.py @@ -95,7 +95,7 @@ def test_hessian_wrt_params(self): pass # ok if some classes don't implement this -class LinearOpTester(OpBase): +class LinearOpTester(OpBase, BaseCase): n_params = 0 @staticmethod @@ -104,6 +104,7 @@ def build_gate(): evotype = Evotype.cast('default') state_space = statespace.default_space_for_dim(dim) rep = evotype.create_dense_superop_rep(np.identity(dim, 'd'), state_space) + #rep = evotype.create_dense_superop_rep(None, np.identity(dim, 'd'), state_space) return op.LinearOperator(rep, evotype) def test_raise_on_invalid_method(self): @@ -600,6 +601,7 @@ def test_include_off_diags_in_degen_blocks(self): [(1j, (1, 0)), (-1j, (3, 2))]] # Im part of 1,0 and 3,2 els (lower triangle); (1,0) and (3,2) must be conjugates ) + class LindbladErrorgenTester(BaseCase): def test_errgen_construction(self): @@ -642,46 +644,6 @@ def test_errgen_construction_from_op(self): errgen_copy.transform_inplace(T) self.assertTrue(np.allclose(errgen_copy.to_dense(), eg.to_dense())) -#TODO - maybe update this to a test of ExpErrorgenOp, which can have dense/sparse versions? -#class LindbladOpBase(object): -# def test_has_nonzero_hessian(self): -# self.assertTrue(self.gate.has_nonzero_hessian()) -# -#class LindbladErrorgenBase(LindbladOpBase, MutableDenseOpBase): -# def test_transform(self): -# gate_copy = self.gate.copy() -# T = UnitaryGaugeGroupElement(np.identity(4, 'd')) -# gate_copy.transform_inplace(T) -# self.assertArraysAlmostEqual(gate_copy, self.gate) -# # TODO test a non-trivial case -# -# def test_element_accessors(self): -# e1 = self.gate[1, 1] -# e2 = self.gate[1][1] -# self.assertAlmostEqual(e1, e2) -# -# s1 = self.gate[1, :] -# s2 = self.gate[1] -# s3 = self.gate[1][:] -# a1 = self.gate[:] -# self.assertArraysAlmostEqual(s1, s2) -# self.assertArraysAlmostEqual(s1, s3) -# -# s4 = self.gate[2:4, 1] -# -# result = len(self.gate) -# # TODO assert correctness -# -# def test_convert(self): -# g = op.convert(self.gate, "CPTP", Basis.cast("pp", 4)) -# # TODO assert correctness -# -# -#class LindbladSparseOpBase(LindbladOpBase, OpBase): -# def assertArraysEqual(self, a, b): -# # Sparse LindbladOp does not support equality natively, so compare errorgen matrices -# self.assertEqual((a.errorgen.to_sparse() != b.errorgen.to_sparse()).nnz, 0) - class LindbladErrorgenBase(OpBase): def test_has_nonzero_hessian(self):