Skip to content

Commit 8e721bf

Browse files
committed
Merge pull request #210 from BoxiLi/testing_bug
Remove run_module_suite
1 parent df096bf commit 8e721bf

File tree

7 files changed

+14
-21
lines changed

7 files changed

+14
-21
lines changed

src/qutip_qip/vqa.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -805,20 +805,20 @@ def plot(self, S=None, label_sets=False, top_ten=False, display=True):
805805
labels = [
806806
self._label_to_sets(S, bitstring) for bitstring in bitstrings
807807
]
808-
plt.bar(
808+
fig, ax = plt.subplots()
809+
ax.bar(
809810
list(range(len(bitstrings))),
810811
probs,
811812
tick_label=labels if label_sets else bitstrings,
812813
width=0.8,
813814
)
814-
plt.xticks(rotation=30)
815-
plt.tight_layout()
816-
plt.xlabel("Measurement outcome")
817-
plt.ylabel("Probability")
818-
plt.title(
815+
ax.tick_params(axis="x", labelrotation=30)
816+
ax.set_xlabel("Measurement outcome")
817+
ax.set_ylabel("Probability")
818+
ax.set_title(
819819
"Measurement Outcomes after Optimisation. "
820820
f"Cost: {round(min_cost, 2)}"
821821
)
822-
plt.tight_layout()
822+
fig.tight_layout()
823823
if display:
824-
plt.show()
824+
fig.show()

tests/test_noise.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from numpy.testing import assert_, run_module_suite, assert_allclose
1+
from numpy.testing import assert_, assert_allclose
22
import numpy as np
33
import pytest
44

tests/test_optpulseprocessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from numpy.testing import (assert_, run_module_suite, assert_allclose,
3+
from numpy.testing import (assert_, assert_allclose,
44
assert_equal)
55
import numpy as np
66
import pytest

tests/test_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from packaging.version import parse as parse_version
44
from numpy.testing import (
5-
assert_, run_module_suite, assert_allclose, assert_equal)
5+
assert_, assert_allclose, assert_equal)
66
import numpy as np
77
import pytest
88

tests/test_pulse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from packaging.version import parse as parse_version
22
import numpy as np
3-
from numpy.testing import assert_, run_module_suite, assert_allclose
3+
from numpy.testing import assert_, assert_allclose
44
import pytest
55

66
import qutip

tests/test_qft.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from numpy.testing import assert_, assert_equal, assert_string_equal, run_module_suite
1+
from numpy.testing import assert_, assert_equal, assert_string_equal
22
from qutip_qip.algorithms.qft import qft, qft_steps, qft_gate_sequence
33
from qutip_qip.operations import gate_sequence_product
44

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

6161
assert not any([gate.name == "CPHASE" for gate in circuit.gates])
62-
63-
if __name__ == "__main__":
64-
run_module_suite()

tests/test_qubits.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from numpy.testing import assert_, run_module_suite
1+
from numpy.testing import assert_
22
from qutip_qip.qubits import qubit_states
33
from qutip import (tensor, basis)
44

@@ -22,7 +22,3 @@ def testQubitStates(self):
2222
psi01_a = tensor(psi0_a, psi1_a)
2323
psi01_b = qubit_states(N=2, states=[0, 1])
2424
assert_(psi01_a == psi01_b)
25-
26-
27-
if __name__ == "__main__":
28-
run_module_suite()

0 commit comments

Comments
 (0)