Esempio n. 1
0
    def test_out_of_range(self):
        with pytest.raises(ValueError):
            fiscalyear.FiscalDay(2016, 0)

        with pytest.raises(ValueError):
            fiscalyear.FiscalDay(2016, -364)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
    def test_wrong_type(self):
        with pytest.raises(TypeError):
            fiscalyear.FiscalDay(2016.5)

        with pytest.raises(TypeError):
            fiscalyear.FiscalDay("hello world")
Esempio n. 5
0
 def e(self):
     return fiscalyear.FiscalDay(2016, 366)
Esempio n. 6
0
 def f(self):
     return fiscalyear.FiscalDay(2017, 1)
Esempio n. 7
0
 def c(self):
     return fiscalyear.FiscalDay("2016", "2")
Esempio n. 8
0
 def b(self):
     return fiscalyear.FiscalDay(2016, 2)
Esempio n. 9
0
 def a(self):
     return fiscalyear.FiscalDay(2016, 1)
Esempio n. 10
0
 def test_next_fiscal_day(self, a):
     assert a.next_fiscal_day == fiscalyear.FiscalDay(2017, 94)
Esempio n. 11
0
 def test_prev_fiscal_day(self, a):
     assert a.prev_fiscal_day == fiscalyear.FiscalDay(2017, 92)