def test_left(self): toyRobot = ToyRobot() toyRobot.left() # Left must not work before place self.assertEqual(toyRobot.report(), None) toyRobot.place(0, 0, Direction.NORTH) toyRobot.left() self.assertEqual(toyRobot.report(), "0, 0, WEST") toyRobot.left() self.assertEqual(toyRobot.report(), "0, 0, SOUTH") toyRobot.left() self.assertEqual(toyRobot.report(), "0, 0, EAST") toyRobot.left() self.assertEqual(toyRobot.report(), "0, 0, NORTH")
def test_left_rotates_robot_90_degrees_to_the_left_when_facing_south(self): robot = ToyRobot(1, 1, "SOUTH") robot.left() self.assertEqual(robot.x, 1) self.assertEqual(robot.y, 1) self.assertEqual(robot.direction, "EAST")