示例#1
0
 def test_type_invalid_4(self, not_an_int: Any) -> None:
     circuit = Circuit(1)
     try:
         circuit.is_point_in_range((0, not_an_int))
     except TypeError:
         return
     except BaseException:
         assert False, 'Unexpected Exception.'
示例#2
0
 def test_type_valid_4(self, an_int: int) -> None:
     circuit = Circuit(4, [2, 2, 3, 3])
     try:
         circuit.is_point_in_range(CircuitPoint(an_int, an_int))
     except TypeError:
         assert False, 'Unexpected TypeError.'
     except BaseException:
         return
示例#3
0
 def test_return_type(self, an_int: int) -> None:
     circuit = Circuit(4, [2, 2, 3, 3])
     assert isinstance(
         circuit.is_point_in_range(
             (an_int, an_int),
         ), (bool, np.bool_),
     )
示例#4
0
 def test_false_pos(self, point: CircuitPointLike) -> None:
     circuit = Circuit(5)
     for i in range(5):
         circuit.append_gate(HGate(), [0])
         circuit.append_gate(HGate(), [1])
         circuit.append_gate(HGate(), [2])
         circuit.append_gate(HGate(), [3])
         circuit.append_gate(HGate(), [4])
     assert not circuit.is_point_in_range(point)