Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_polynomial_rotations_mutability(self):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError): # no state qubits set
print(polynomial_rotations.draw())
_ = str(polynomial_rotations.draw())

with self.subTest(msg="default setup, just setting number of state qubits"):
polynomial_rotations.num_state_qubits = 2
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_linear_rotations_mutability(self):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError): # no state qubits set
print(linear_rotation.draw())
_ = str(linear_rotation.draw())

with self.subTest(msg="default setup, just setting number of state qubits"):
linear_rotation.num_state_qubits = 2
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_piecewise_linear_rotations_mutability(self):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError): # no state qubits set
print(pw_linear_rotations.draw())
_ = str(pw_linear_rotations.draw())

with self.subTest(msg="default setup, just setting number of state qubits"):
pw_linear_rotations.num_state_qubits = 2
Expand Down
4 changes: 2 additions & 2 deletions test/python/circuit/library/test_integer_comparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ def test_mutability(self):

with self.subTest(msg="missing num state qubits and value"):
with self.assertRaises(AttributeError):
print(comp.draw())
_ = str(comp.draw())

comp.num_state_qubits = 2

with self.subTest(msg="missing value"):
with self.assertRaises(AttributeError):
print(comp.draw())
_ = str(comp.draw())

comp.value = 0
comp.geq = True
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_nlocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def test_pairwise_entanglement_raises(self):

# pairwise entanglement is only defined if the entangling gate has 2 qubits
with self.assertRaises(ValueError):
print(nlocal.draw())
_ = str(nlocal.draw())

def test_entanglement_by_list(self):
"""Test setting the entanglement by list.
Expand Down
1 change: 0 additions & 1 deletion test/python/circuit/library/test_permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def test_qpy(self):
circuit.cx(0, 1)
circuit.append(PermutationGate([1, 2, 0]), [2, 4, 5])
circuit.h(4)
print(circuit)

qpy_file = io.BytesIO()
dump(circuit, qpy_file)
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/library/test_piecewise_chebyshev.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def f_x_1(x):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError): # no state qubits set
print(pw_approximation.draw())
_ = str(pw_approximation.draw())

with self.subTest(msg="default setup, just setting number of state qubits"):
pw_approximation.num_state_qubits = 2
Expand Down
4 changes: 2 additions & 2 deletions test/python/circuit/library/test_weighted_adder.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_mutability(self):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError):
print(adder.draw())
_ = str(adder.draw())

with self.subTest(msg="default weights"):
adder.num_state_qubits = 3
Expand All @@ -81,7 +81,7 @@ def test_mutability(self):
with self.subTest(msg="mismatching number of state qubits and weights"):
with self.assertRaises(ValueError):
adder.weights = [0, 1, 2, 3]
print(adder.draw())
_ = str(adder.draw())

with self.subTest(msg="change all attributes"):
adder.num_state_qubits = 4
Expand Down
2 changes: 1 addition & 1 deletion test/python/circuit/test_piecewise_polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def pw_poly(x):

with self.subTest(msg="missing number of state qubits"):
with self.assertRaises(AttributeError): # no state qubits set
print(pw_polynomial_rotations.draw())
_ = str(pw_polynomial_rotations.draw())

with self.subTest(msg="default setup, just setting number of state qubits"):
pw_polynomial_rotations.num_state_qubits = 2
Expand Down
1 change: 0 additions & 1 deletion test/python/primitives/test_backend_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def test_sample_run_multiple_circuits(self, backend):
bell = self._circuit[1]
sampler = BackendSampler(backend=backend)
result = sampler.run([bell, bell, bell]).result()
# print([q.binary_probabilities() for q in result.quasi_dists])
self._compare_probs(result.quasi_dists[0], self._target[1])
self._compare_probs(result.quasi_dists[1], self._target[1])
self._compare_probs(result.quasi_dists[2], self._target[1])
Expand Down
2 changes: 0 additions & 2 deletions test/python/primitives/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def test_sampler_run(self):
self.assertIsInstance(job, JobV1)
result = job.result()
self.assertIsInstance(result, SamplerResult)
# print([q.binary_probabilities() for q in result.quasi_dists])
self._compare_probs(result.quasi_dists, self._target[1])

def test_sample_run_multiple_circuits(self):
Expand All @@ -103,7 +102,6 @@ def test_sample_run_multiple_circuits(self):
bell = self._circuit[1]
sampler = Sampler()
result = sampler.run([bell, bell, bell]).result()
# print([q.binary_probabilities() for q in result.quasi_dists])
self._compare_probs(result.quasi_dists[0], self._target[1])
self._compare_probs(result.quasi_dists[1], self._target[1])
self._compare_probs(result.quasi_dists[2], self._target[1])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,8 @@ def test_visualize_does_not_throw_error(self):
# An error may be thrown if visualization code calls op.condition instead
# of getattr(op, "condition", None)
clifford = random_clifford(3, seed=0)
print(clifford)
_ = str(clifford)
_ = repr(clifford)

@combine(num_qubits=[1, 2, 3, 4])
def test_from_matrix_round_trip(self, num_qubits):
Expand Down