forked from Qiskit/qiskit-aer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test deprecation warnings and call parent's setUpClass
In Qiskit/qiskit#6753 the base test classes were fixed to assert that setUp and setUpClass in the base test class are always called. This is necessary to ensure that all the warning assertions always work. However this change had the unintended side effect of causing Aer's CI to fail because it wasn't calling super().setUpClass(). This commit makes this change to fix that failure. However, because now we're running enforcement that tests can't raise unhandled DeprecationWarnings a few spots in the tests were emitting deprecation warnings. The deprecated syntax is either fixed or if it's testing something in Aer that's deprecated an assertion on that warning is added to fix the failure.
- Loading branch information
Showing
9 changed files
with
94 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
import numpy as np | ||
from qiskit.circuit import Gate | ||
|
||
class CustomMultiplexer(Gate): | ||
|
||
def validate_parameter(self, param): | ||
return param | ||
|
||
def multiplexer_multi_controlled_x(num_control): | ||
# Multi-controlled X gate multiplexer | ||
identity = np.array(np.array([[1, 0], [0, 1]], dtype=complex)) | ||
x_gate = np.array(np.array([[0, 1], [1, 0]], dtype=complex)) | ||
num_qubits = num_control + 1 | ||
multiplexer = Gate('multiplexer', num_qubits, (2 ** num_control-1) * [identity] + [x_gate]) | ||
return multiplexer | ||
multiplexer = CustomMultiplexer( | ||
'multiplexer', | ||
num_qubits, (2 ** num_control-1) * [identity] + [x_gate], | ||
) | ||
return multiplexer |