def test_method_update_stopped_ascending_time(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (100, 1, 100) instance = PitStopFlyout(race_data, driver, font, size, location) for time in range(16): instance.update(location, time)
def test_field_persist_set_false(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (0, 1, 0) instance = PitStopFlyout(race_data, driver, font, size, location) instance.persist = False self.assertFalse(instance.persist)
def test_method_close_flyout_set_is_closing(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (100, 1, 100) instance = PitStopFlyout(race_data, driver, font, size, location) instance.close_flyout() self.assertTrue(instance.is_closing)
def test_method_close_flyout(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (100, 1, 100) instance = PitStopFlyout(race_data, driver, font, size, location) instance.close_flyout() expected_result = Animation self.assertIsInstance(instance.animations[-1], expected_result)
def test_property_text_color_pit_out(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (0, 1, 0) instance = PitStopFlyout(race_data, driver, font, size, location) for time in range(16): instance.update(location, time) expected_result = (255, 255, 255, 255) self.assertTupleEqual(instance.text_color, expected_result)
def test_method_to_frame(self, mock_image, mock_draw): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (100, 1, 100) mock_image.new = MagicMock(spec='numpy.ndarray', autospec=True) font.getsize = MagicMock(return_value=(20, 20)) mock_draw.text = MagicMock(spec='numpy.ndarray') instance = PitStopFlyout(race_data, driver, font, size, location) from PIL.Image import Image as expected_value self.assertIsInstance(instance.to_frame(), expected_value)
def test_init(self): race_data = MagicMock(spec='replayenhancer.RaceData.RaceData', autospec=True) driver = MagicMock(spec='replayenhancer.RaceData.Driver', autospec=True) font = MagicMock(spec='PIL.ImageFont', autospec=True) size = (100, 100) location = (100, 1, 100) instance = PitStopFlyout(race_data, driver, font, size, location) expected_result = PitStopFlyout self.assertIsInstance(instance, expected_result)