def test_out_of_range(self): with pytest.raises(ValueError): fiscalyear.FiscalDay(2016, 0) with pytest.raises(ValueError): fiscalyear.FiscalDay(2016, -364)
def test_prev_fiscal_day(self, a, b, f): assert a == b.prev_fiscal_day assert a.prev_fiscal_day == fiscalyear.FiscalDay(2015, 365) assert f.prev_fiscal_day == fiscalyear.FiscalDay(2016, 366)
def test_current(self, mocker): mock_today = mocker.patch.object(fiscalyear.FiscalDate, "today") mock_today.return_value = fiscalyear.FiscalDate(2016, 10, 1) current = fiscalyear.FiscalDay.current() assert current == fiscalyear.FiscalDay(2017, 1)
def test_wrong_type(self): with pytest.raises(TypeError): fiscalyear.FiscalDay(2016.5) with pytest.raises(TypeError): fiscalyear.FiscalDay("hello world")
def e(self): return fiscalyear.FiscalDay(2016, 366)
def f(self): return fiscalyear.FiscalDay(2017, 1)
def c(self): return fiscalyear.FiscalDay("2016", "2")
def b(self): return fiscalyear.FiscalDay(2016, 2)
def a(self): return fiscalyear.FiscalDay(2016, 1)
def test_next_fiscal_day(self, a): assert a.next_fiscal_day == fiscalyear.FiscalDay(2017, 94)
def test_prev_fiscal_day(self, a): assert a.prev_fiscal_day == fiscalyear.FiscalDay(2017, 92)