Skip to content

Commit

Permalink
fix sympy equality check
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMacCQ committed Jan 27, 2025
1 parent 0212c9b commit 263b59d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytket/tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from hypothesis import HealthCheck, given, settings, strategies
from hypothesis.strategies._internal import SearchStrategy
from simulator import TketSimBackend, TketSimShotBackend # type: ignore
from sympy import symbols
from sympy import I, symbols

from pytket.backends.backend import Backend
from pytket.circuit import Circuit, OpType, Qubit
Expand Down Expand Up @@ -94,7 +94,8 @@ def test_dict_export() -> None:
qps1 = QubitPauliString(Qubit(0), Pauli.Y)
qps2 = QubitPauliString(Qubit(0), Pauli.X)
op = QubitPauliOperator({qps1: 1j, qps2: 0.5})
assert op.get_dict() == {qps1: 1j, qps2: 0.5}
# Do equality check with a sympy "I" for the imaginary part
assert op.get_dict() == {qps1: 1 * I, qps2: 0.5}


def test_shots_to_counts() -> None:
Expand Down

0 comments on commit 263b59d

Please sign in to comment.