예제 #1
0
    def test_next_month_for_invalid_frequency(self, *patches):
        patch_days_in_common_year, patch_days_in_leap_year = patches
        days_in_leap_year = FAKE.random_int(min=1)
        days_in_common_year = FAKE.random_int(min=1)
        patch_days_in_leap_year.__get__ = lambda *_: days_in_leap_year
        patch_days_in_common_year.__get__ = lambda *_: days_in_common_year

        calendar = self.calendar_factory.build()
        cd = ConvertibleDate(calendar=calendar)
        bad_frequency = FAKE.random_int(min=10000, max=19999)
        with pytest.raises(ValueError):
            cd.next_month(FAKE.pyint(), FAKE.pyint(), bad_frequency)
예제 #2
0
 def test_next_ast_year_raises(self):
     calendar = self.calendar_factory.build()
     cd = ConvertibleDate(calendar=calendar)
     non_positive_frequency = FAKE.random_int(min=-9999, max=0)
     with pytest.raises(ValueError):
         cd.next_ast_year(FAKE.pyint(), non_positive_frequency)