Skip to content

Commit 6e31654

Browse files
committed
Removed clear_registry function
1 parent b6219a9 commit 6e31654

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tests/compiler/test_registry.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from bqskit.compiler import compile
1111
from bqskit.compiler.machine import MachineModel
1212
from bqskit.compiler.registry import _workflow_registry
13-
from bqskit.compiler.registry import clear_registry
1413
from bqskit.compiler.registry import register_workflow
1514
from bqskit.compiler.workflow import Workflow
1615
from bqskit.compiler.workflow import WorkflowLike
@@ -74,26 +73,30 @@ class TestRegisterWorkflow:
7473

7574
@pytest.fixture(autouse=True)
7675
def setup(self) -> None:
77-
# _workflow_registry.clear()
78-
clear_registry()
76+
assert _workflow_registry == _workflow_registry
77+
global _workflow_registry
78+
_workflow_registry.clear()
7979

8080
def test_register_workflow(self) -> None:
81+
global _workflow_registry
8182
assert _workflow_registry == {}
8283
gateset = [CZGate(), HGate(), RZGate()]
8384
num_qudits = 3
8485
machine = MachineModel(num_qudits, gate_set=gateset)
8586
workflow = [QuickPartitioner(), ScanningGateRemovalPass()]
86-
register_workflow(machine, workflow)
87+
register_workflow(machine, workflow, 1)
8788
assert machine in _workflow_registry
8889
assert 1 in _workflow_registry[machine]
8990
assert workflow_match(_workflow_registry[machine][1], workflow)
9091

9192
def test_custom_compile_machine(self) -> None:
93+
global _workflow_registry
94+
assert _workflow_registry == {}
9295
gateset = [CZGate(), HGate(), RZGate()]
9396
num_qudits = 3
9497
machine = MachineModel(num_qudits, gate_set=gateset)
9598
workflow = [QuickPartitioner(2)]
96-
register_workflow(machine, workflow)
99+
register_workflow(machine, workflow, 1)
97100
circuit = simple_circuit(num_qudits, gateset)
98101
result = compile(circuit, machine)
99102
assert unitary_match(result, circuit)
@@ -103,11 +106,13 @@ def test_custom_compile_machine(self) -> None:
103106
assert result.gate_counts == circuit.gate_counts
104107

105108
def test_custom_compile_gateset(self) -> None:
109+
global _workflow_registry
110+
assert _workflow_registry == {}
106111
gateset = [CZGate(), HGate(), RZGate()]
107112
num_qudits = 3
108113
machine = MachineModel(num_qudits, gate_set=gateset)
109114
workflow = [QuickPartitioner(2)]
110-
register_workflow(gateset, workflow)
115+
register_workflow(gateset, workflow, 1)
111116
circuit = simple_circuit(num_qudits, gateset)
112117
result = compile(circuit, machine)
113118
assert unitary_match(result, circuit)
@@ -117,6 +122,8 @@ def test_custom_compile_gateset(self) -> None:
117122
assert result.gate_counts == circuit.gate_counts
118123

119124
def test_custom_opt_level(self) -> None:
125+
global _workflow_registry
126+
assert _workflow_registry == {}
120127
gateset = [CZGate(), HGate(), RZGate()]
121128
num_qudits = 3
122129
machine = MachineModel(num_qudits, gate_set=gateset)

0 commit comments

Comments
 (0)