Skip to content

Commit

Permalink
Merge pull request #210 from BoxiLi/testing_bug
Browse files Browse the repository at this point in the history
Remove run_module_suite
  • Loading branch information
BoxiLi committed Jul 16, 2023
2 parents ecece1a + b176e67 commit 18caa9f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
16 changes: 8 additions & 8 deletions src/qutip_qip/vqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,20 +805,20 @@ def plot(self, S=None, label_sets=False, top_ten=False, display=True):
labels = [
self._label_to_sets(S, bitstring) for bitstring in bitstrings
]
plt.bar(
fig, ax = plt.subplots()
ax.bar(
list(range(len(bitstrings))),
probs,
tick_label=labels if label_sets else bitstrings,
width=0.8,
)
plt.xticks(rotation=30)
plt.tight_layout()
plt.xlabel("Measurement outcome")
plt.ylabel("Probability")
plt.title(
ax.tick_params(axis="x", labelrotation=30)
ax.set_xlabel("Measurement outcome")
ax.set_ylabel("Probability")
ax.set_title(
"Measurement Outcomes after Optimisation. "
f"Cost: {round(min_cost, 2)}"
)
plt.tight_layout()
fig.tight_layout()
if display:
plt.show()
fig.show()
2 changes: 1 addition & 1 deletion tests/test_noise.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numpy.testing import assert_, run_module_suite, assert_allclose
from numpy.testing import assert_, assert_allclose
import numpy as np
import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_optpulseprocessor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from numpy.testing import (assert_, run_module_suite, assert_allclose,
from numpy.testing import (assert_, assert_allclose,
assert_equal)
import numpy as np
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from packaging.version import parse as parse_version
from numpy.testing import (
assert_, run_module_suite, assert_allclose, assert_equal)
assert_, assert_allclose, assert_equal)
import numpy as np
import pytest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pulse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from packaging.version import parse as parse_version
import numpy as np
from numpy.testing import assert_, run_module_suite, assert_allclose
from numpy.testing import assert_, assert_allclose
import pytest

import qutip
Expand Down
5 changes: 1 addition & 4 deletions tests/test_qft.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numpy.testing import assert_, assert_equal, assert_string_equal, run_module_suite
from numpy.testing import assert_, assert_equal, assert_string_equal
from qutip_qip.algorithms.qft import qft, qft_steps, qft_gate_sequence
from qutip_qip.operations import gate_sequence_product

Expand Down Expand Up @@ -59,6 +59,3 @@ def testQFTGateSequenceWithCNOT(self):
circuit = qft_gate_sequence(N, swapping=False, to_cnot=True)

assert not any([gate.name == "CPHASE" for gate in circuit.gates])

if __name__ == "__main__":
run_module_suite()
6 changes: 1 addition & 5 deletions tests/test_qubits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from numpy.testing import assert_, run_module_suite
from numpy.testing import assert_
from qutip_qip.qubits import qubit_states
from qutip import (tensor, basis)

Expand All @@ -22,7 +22,3 @@ def testQubitStates(self):
psi01_a = tensor(psi0_a, psi1_a)
psi01_b = qubit_states(N=2, states=[0, 1])
assert_(psi01_a == psi01_b)


if __name__ == "__main__":
run_module_suite()

0 comments on commit 18caa9f

Please sign in to comment.