from rover import Rover from rover.rover import HEADINGS def test_can_land(): assert Rover() def test_has_location_and_heading(): rover = Rover() assert isinstance(rover.location.x, int) assert isinstance(rover.location.y, int) assert rover.location.heading in HEADINGS def test_can_land_at_specified_location(): rover = Rover(x=1, y=2, heading='E') assert rover.location.x == 1 assert rover.location.heading == 'E' def test_can_move_east(): rover = Rover(x=1, y=2, heading='E') rover.move('FFF') assert rover.location.x == 4 def test_can_move_north(): rover = Rover(x=1, y=2, heading='N') rover.move('FFF') assert rover.location.y == 5 def test_rover_reports_location(capsys): rover = Rover(x=1, y=2, heading='N') rover.move('FFF') captured = capsys.readouterr() captured.out.split() == 'Location (5, 2) Heading N'