예제 #1
0
 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))
예제 #2
0
 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))
예제 #3
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))
예제 #4
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))