Exemplo 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)
Exemplo 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)
Exemplo 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)
Exemplo n.º 4
0
    def test_wrong_type(self):
        with pytest.raises(TypeError):
            fiscalyear.FiscalDay(2016.5)

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