コード例 #1
0
    def test_registry03(self):
        "Duplicates"
        prev_range1 = date_range.PreviousYearRange()
        prev_range2 = date_range.PreviousYearRange()
        curr_range = date_range.CurrentYearRange()

        registry = date_range.DateRangeRegistry()

        with self.assertRaises(registry.RegistrationError):
            registry.register(prev_range1, curr_range, prev_range2)
コード例 #2
0
    def setUpClass(cls):
        # super(DateRangeTestCase, cls).setUpClass()
        super().setUpClass()

        cls.registry = date_range.DateRangeRegistry(
                date_range.PreviousYearRange(),
                date_range.CurrentYearRange(),
                date_range.NextYearRange(),

                date_range.PreviousQuarterRange(),
                date_range.CurrentQuarterRange(),
                date_range.NextQuarterRange(),

                date_range.PreviousMonthRange(),
                date_range.CurrentMonthRange(),
                date_range.NextMonthRange(),

                date_range.YesterdayRange(),
                date_range.TodayRange(),
                date_range.TomorrowRange(),

                date_range.FutureRange(),
                date_range.PastRange(),

                date_range.EmptyRange(),
                date_range.NotEmptyRange(),
        )
コード例 #3
0
    def test_registry01(self):
        "Register in __init__"
        prev_range = date_range.PreviousYearRange()
        curr_range = date_range.CurrentYearRange()

        registry = date_range.DateRangeRegistry(prev_range, curr_range)

        self.assertIs(prev_range, registry.get_range(prev_range.name))
        self.assertIs(curr_range, registry.get_range(curr_range.name))
        self.assertIsNone(registry.get_range())
コード例 #4
0
    def test_registry02(self):
        "register() method"
        prev_range = date_range.PreviousYearRange()
        curr_range = date_range.CurrentYearRange()

        registry = date_range.DateRangeRegistry()
        registry.register(prev_range, curr_range)

        self.assertIs(prev_range, registry.get_range(prev_range.name))
        self.assertIs(curr_range, registry.get_range(curr_range.name))
        self.assertIsNone(registry.get_range())