예제 #1
0
    def test_can_get_distance_to_point(self, test_wire, test_point, expected):
        wire = systems.Wire(test_wire)
        ret_val = wire.distance_to_point(test_point)

        assert ret_val == expected
예제 #2
0
 def test_parse_instruction(self, test_input, expected):
     assert systems.Wire().parse_instruction(test_input) == expected
예제 #3
0
 def test_parse_instruction_raises_exception_with_bad_instruction(self):
     with pytest.raises(ValueError):
         systems.Wire().parse_instruction("F320")
예제 #4
0
 def test_points_raises_exception_when_segments_not_continuous(
         self, test_input):
     wire = systems.Wire(test_input)
     del wire.segments[1]
     with pytest.raises(RuntimeError):
         points = wire.points
예제 #5
0
 def test_can_add_segment(self, test_input, expected):
     wire = systems.Wire()
     wire.add_segment(test_input)
     segment = wire.segments[-1]
     assert (segment.start, segment.end) == expected
예제 #6
0
 def test_init_raises_exception_with_bad_instructions(self):
     with pytest.raises(TypeError):
         wire = systems.Wire({})
예제 #7
0
 def test_can_add_wire(self, fm):
     wire = systems.Wire()
     fm.add_wire(wire)
     assert wire in fm.wires
예제 #8
0
 def test_init(self, test_input, expected):
     wire = systems.Wire(test_input)
     assert wire.points == expected