Esempio n. 1
0
    def test_speed_normalised_up_when_no_collision(self, mock_pygame,
                                                   mock_load_png):
        self._configure_mocks(mock_pygame, mock_load_png)

        mock_pygame.sprite.spritecollide.return_value = []

        ball = Ball((100, 100), 2.36, 8, normalisation_rate=0.03)
        ball.speed = 5  # Reduce the speed below the base speed.

        ball.update()

        self.assertEqual(ball.speed, 5.03)
Esempio n. 2
0
    def test_speed_normalised_down_when_no_collision(self, mock_pygame,
                                                     mock_load_png):
        self._configure_mocks(mock_pygame, mock_load_png)

        mock_pygame.sprite.spritecollide.return_value = []

        ball = Ball((100, 100), 2.36, 8, normalisation_rate=0.03)
        ball.speed = 12  # Increase the speed above the base speed.

        ball.update()

        self.assertEqual(ball.speed, 11.97)