Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_year_regular(self):
assert 39755 == date(2008, 11, 3)
def test_year_for_29_feb(self):
assert 39507 == date(2008, 2, 29)
def test_yearfrac_basis_0(self):
assert 7.30277777777778 == pytest.approx(
yearfrac(date(2008, 1, 1), date(2015, 4, 20)))
def test_values_can_str(self):
assert date('2016', 1, 1) == date(2016, '1', 1) == date(2016, 1, '1')
def test_yearfrac_basis_1_sub_year(self):
assert 11 / 365 == pytest.approx(
yearfrac(date(2015, 4, 20), date(2015, 5, 1), 1))
assert 11 / 366 == pytest.approx(
yearfrac(date(2016, 4, 20), date(2016, 5, 1), 1))
assert 316 / 366 == pytest.approx(
yearfrac(date(2016, 2, 20), date(2017, 1, 1), 1))
assert 61 / 366 == pytest.approx(
yearfrac(date(2015, 12, 31), date(2016, 3, 1), 1))
def test_yearfrac_basis_3(self):
assert 7.304109589 == pytest.approx(
yearfrac(date(2008, 1, 1), date(2015, 4, 20), 3))
def test_yearfrac_basis_1(self):
assert 7.299110198 == pytest.approx(
yearfrac(date(2008, 1, 1), date(2015, 4, 20), 1))
def test_yearfrac_basis_1_sub_year(self):
assert 11 / 365 == pytest.approx(
yearfrac(date(2015, 4, 20), date(2015, 5, 1), 1))
assert 11 / 366 == pytest.approx(
yearfrac(date(2016, 4, 20), date(2016, 5, 1), 1))
assert 316 / 366 == pytest.approx(
yearfrac(date(2016, 2, 20), date(2017, 1, 1), 1))
assert 61 / 366 == pytest.approx(
yearfrac(date(2015, 12, 31), date(2016, 3, 1), 1))