test_rover.py 701 B

1234567891011121314151617181920212223242526272829
  1. from rover import Rover
  2. from rover.rover import HEADINGS
  3. def test_can_land():
  4. assert Rover()
  5. def test_has_location_and_heading():
  6. rover = Rover()
  7. assert isinstance(rover.location.x, int)
  8. assert isinstance(rover.location.y, int)
  9. assert rover.location.heading in HEADINGS
  10. def test_can_land_at_specified_location():
  11. rover = Rover(x=1, y=2, heading='E')
  12. assert rover.location.x == 1
  13. assert rover.location.heading == 'E'
  14. def test_can_move_east():
  15. rover = Rover(x=1, y=2, heading='E')
  16. rover.move('FFF')
  17. assert rover.location.x == 4
  18. def test_can_move_north():
  19. rover = Rover(x=1, y=2, heading='N')
  20. rover.move('FFF')
  21. assert rover.location.y == 5