def test_can_move_period_without_zooming(self): a = Animation(self.timeline, py_period("1 Jan 2010", "2 Jan 2010"), 2, py_period("3 Jan 2010", "4 Jan 2010")) a.change_current_period(1) self.assertEquals(a.current_period, py_period("2 Jan 2010", "3 Jan 2010"))
def when_navigating(self, fn, start, end, week_starts_on_monday=True): def navigation_fn(fn): self.new_period = fn(self.time_period) self.time_period = py_period(start, end) main_frame = Mock(MainFrame) main_frame.week_starts_on_monday.return_value = week_starts_on_monday fn(main_frame, self.time_period, navigation_fn)
def then_period_becomes(self, start, end): self.assertEquals(py_period(start, end), self.new_period)
def assert_navigation_raises(self, exception, fn, start, end): def navigation_fn(fn): self.assertRaises(exception, fn, self.time_period) self.time_period = py_period(start, end) fn(None, self.time_period, navigation_fn)
def assert_event_has_period(self, start, end, event=None): if event is None: event = self.selected_events[0] self.assertEquals(event.time_period, py_period(start, end))
def then_event_gets_period(self, start, end): self.assertEquals(py_period(start, end), self.event_being_resized.time_period)
def then_event_gets_period(self, start, end): self.assertEquals( py_period(start, end), self.event_being_resized.time_period)
def assert_displays_period(self, start, end): view_properties = self.get_view_properties_used_when_drawing() self.assertEquals( py_period(start, end), view_properties.displayed_period)
def assert_event_has_period(self, event, start, end): self.assertEquals(py_period(start, end), event.time_period)
def init_view_with_db_with_period(self, start, end): self.db._set_displayed_period(py_period(start, end)) self.init_view_with_db()
def assert_displays_period(self, start, end): view_properties = self.get_view_properties_used_when_drawing() self.assertEquals(py_period(start, end), view_properties.displayed_period)
def given_displayed_period(self, start, end): self.view_properties.displayed_period = py_period(start, end)