Пример #1
0
    def test_registry02(self):
        "register() method"
        registry = DatePeriodRegistry()
        registry.register(DaysPeriod, WeeksPeriod)

        period = registry.get_period(DaysPeriod.name, 1)
        self.assertIsInstance(period, DaysPeriod)

        self.assertIsNone(registry.get_period(MinutesPeriod.name, 1))
Пример #2
0
    def test_registry03(self):
        "Duplicates"
        registry = DatePeriodRegistry()

        with self.assertRaises(registry.RegistrationError):
            registry.register(DaysPeriod, WeeksPeriod, DaysPeriod)