Skip to content

Commit

Permalink
Avoid calling QPDBasis.from_gate in experiments tests
Browse files Browse the repository at this point in the history
We should instead call `from_instruction`, since `from_gate` was
deprecated in #371.
  • Loading branch information
garrison committed Sep 11, 2023
1 parent 48f1e04 commit 509e647
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/cutting/test_cutting_experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_generate_cutting_experiments(self):
with self.subTest("simple circuit and observable"):
qc = QuantumCircuit(2)
qc.append(
TwoQubitQPDGate(QPDBasis.from_gate(CXGate()), label="cut_cx"),
TwoQubitQPDGate(QPDBasis.from_instruction(CXGate()), label="cut_cx"),
qargs=[0, 1],
)
comp_coeffs = [
Expand All @@ -58,13 +58,13 @@ def test_generate_cutting_experiments(self):
qc = QuantumCircuit(2)
qc.append(
SingleQubitQPDGate(
QPDBasis.from_gate(CXGate()), label="cut_cx_0", qubit_id=0
QPDBasis.from_instruction(CXGate()), label="cut_cx_0", qubit_id=0
),
qargs=[0],
)
qc.append(
SingleQubitQPDGate(
QPDBasis.from_gate(CXGate()), label="cut_cx_0", qubit_id=1
QPDBasis.from_instruction(CXGate()), label="cut_cx_0", qubit_id=1
),
qargs=[1],
)
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_generate_cutting_experiments(self):
with self.subTest("test bad label"):
qc = QuantumCircuit(2)
qc.append(
TwoQubitQPDGate(QPDBasis.from_gate(CXGate()), label="cut_cx"),
TwoQubitQPDGate(QPDBasis.from_instruction(CXGate()), label="cut_cx"),
qargs=[0, 1],
)
partitioned_problem = partition_problem(
Expand Down Expand Up @@ -142,7 +142,9 @@ def test_generate_cutting_experiments(self):
with self.subTest("test single qubit qpd gate in unseparated circuit"):
qc = QuantumCircuit(2)
qc.append(
SingleQubitQPDGate(QPDBasis.from_gate(CXGate()), 0, label="cut_cx_0"),
SingleQubitQPDGate(
QPDBasis.from_instruction(CXGate()), 0, label="cut_cx_0"
),
qargs=[0],
)
with pytest.raises(ValueError) as e_info:
Expand Down

0 comments on commit 509e647

Please sign in to comment.