Skip to content

Commit

Permalink
Remove unstable test
Browse files Browse the repository at this point in the history
  • Loading branch information
chmwzc committed Mar 20, 2024
1 parent 7f77b9c commit 4c86909
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/test_expectation_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@


@pytest.mark.parametrize(
"terms,gates_to_add,expected,threshold",
"terms,gates_to_add,expected",
[
(Z(0), [gates.X(0)], -1.0, None),
(Z(0) * Z(1), [gates.X(0)], -1.0, None),
(X(0), [gates.H(0)], 1.0, None),
(X(0), [gates.X(0), gates.X(0)], 0.0, 0.05),
(Z(0), [gates.X(0)], -1.0),
(Z(0) * Z(1), [gates.X(0)], -1.0),
(X(0), [gates.H(0)], 1.0),
],
)
def test_expectation_samples(terms, gates_to_add, expected, threshold):
def test_expectation_samples(terms, gates_to_add, expected):
"""Test from_samples functionality of expectation function with various Hamiltonians"""
hamiltonian = SymbolicHamiltonian(terms)
circuit = Circuit(2)
circuit.add(gates_to_add)
result = expectation(circuit, hamiltonian, from_samples=True)
assert pytest.approx(result, abs=threshold) == expected
assert result == expected


def test_measurement_basis_rotations_error():
Expand Down

0 comments on commit 4c86909

Please sign in to comment.