Esempio n. 1
0
 def test_type_invalid_2(self, not_an_int: Any) -> None:
     circuit = Circuit(4, [2, 2, 3, 3])
     try:
         circuit.is_cycle_in_range(not_an_int)
     except TypeError:
         return
     except BaseException:
         assert False, 'Unexpected Exception.'
Esempio n. 2
0
 def test_type_valid_2(self, an_int: int) -> None:
     circuit = Circuit(4, [2, 2, 3, 3])
     try:
         circuit.is_cycle_in_range(an_int)
     except TypeError:
         assert False, 'Unexpected TypeError.'
     except BaseException:
         return
Esempio n. 3
0
 def test_false_pos(self, cycle_index: int) -> None:
     circuit = Circuit(1)
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     assert not circuit.is_cycle_in_range(cycle_index)
Esempio n. 4
0
 def test_true_neg(self, cycle_index: int) -> None:
     circuit = Circuit(1)
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     circuit.append_gate(HGate(), [0])
     assert circuit.is_cycle_in_range(cycle_index)
Esempio n. 5
0
 def test_return_type(self, an_int: int) -> None:
     circuit = Circuit(4, [2, 2, 3, 3])
     assert isinstance(circuit.is_cycle_in_range(an_int), (bool, np.bool_))