def test_key_press_stays(self): snake = Snake() snake.last_direction = (-1, 0) snake.direction = (-1, 0) snake.key_press("right") self.assertEqual(snake.last_direction, (-1, 0)) self.assertEqual(snake.direction, (-1, 0))
def test_key_press_moves(self): snake = Snake() snake.key_press('up') self.assertEqual(snake.last_direction, (1, 0)) self.assertEqual(snake.direction, (0, -1))