Exemplo n.º 1
0
 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 = wx_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 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 = wx_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(wx_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 = wx_period(start, end)
        fn(None, self.time_period, navigation_fn)
Exemplo n.º 5
0
 def then_period_becomes(self, start, end):
     self.assertEquals(wx_period(start, end), self.new_period)
Exemplo n.º 6
0
 def assert_navigation_raises(self, exception, fn, start, end):
     def navigation_fn(fn):
         self.assertRaises(exception, fn, self.time_period)
     self.time_period = wx_period(start, end)
     fn(None, self.time_period, navigation_fn)
 def test_move_period_num_years_adds_given_number_of_years(self):
     a_period = wx_period("1 Jan 2010", "5 Jan 2010")
     new_period = move_period_num_years(a_period, 1)
     self.assertEquals(wx_period("1 Jan 2011", "5 Jan 2011"), new_period)
 def test_move_period_num_years_returns_none_if_day_does_not_exist(self):
     a_period = wx_period("29 Feb 2012", "5 Mar 2012")
     new_period = move_period_num_years(a_period, 1)
     self.assertEquals(None, new_period)
 def test_move_period_num_months_returns_none_if_day_does_not_exist(self):
     a_period = wx_period("31 Jan 2010", "15 Mar 2010")
     new_period = move_period_num_months(a_period, 1)
     self.assertEquals(None, new_period)
 def test_move_period_num_months_can_handle_year_boundries(self):
     a_period = wx_period("1 Jan 2010", "5 Jan 2010")
     new_period = move_period_num_months(a_period, -2)
     self.assertEquals(wx_period("1 Nov 2009", "5 Nov 2009"), new_period)
 def test_move_period_num_months_adds_given_number_of_months(self):
     a_period = wx_period("1 Jan 2010", "5 Jan 2010")
     new_period = move_period_num_months(a_period, 2)
     self.assertEquals(wx_period("1 Mar 2010", "5 Mar 2010"), new_period)
 def test_move_period_num_weeks_adds_given_number_of_weeks(self):
     a_period = wx_period("20 Dec 2010", "31 Dec 2010")
     new_period = move_period_num_weeks(a_period, -3)
     self.assertEquals(wx_period("29 Nov 2010", "10 Dec 2010"), new_period)
 def test_move_period_num_days_adds_given_number_of_days(self):
     a_period = wx_period("1 Jan 2010", "30 Jan 2010")
     new_period = move_period_num_days(a_period, 6)
     self.assertEquals(wx_period("7 Jan 2010", "5 Feb 2010"), new_period)