def test_init(self, label, pre_processing): """Test __init__""" fer_op = FermionicOp(pre_processing(label)) self.assertListEqual(fer_op.to_list(), [(label, 1)]) self.assertFermionEqual(eval(repr(fer_op)), fer_op) # pylint: disable=eval-used
def assertFermionEqual(self, first: FermionicOp, second: FermionicOp): """Fail if two FermionicOps are different. Note that this equality check is approximated since the true equality check is costly. """ self.assertSetEqual(frozenset(first.to_list()), frozenset(second.to_list()))