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
 def test_parse_instruction(self, test_input, expected):
     assert systems.Wire().parse_instruction(test_input) == expected
 def test_parse_instruction_raises_exception_with_bad_instruction(self):
     with pytest.raises(ValueError):
         systems.Wire().parse_instruction("F320")
 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
 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
 def test_init_raises_exception_with_bad_instructions(self):
     with pytest.raises(TypeError):
         wire = systems.Wire({})
 def test_can_add_wire(self, fm):
     wire = systems.Wire()
     fm.add_wire(wire)
     assert wire in fm.wires
 def test_init(self, test_input, expected):
     wire = systems.Wire(test_input)
     assert wire.points == expected