コード例 #1
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
    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))
コード例 #2
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_year_must_have_less_than_10000(self):
     with self.assertRaises(ValueError):
         date(10000, 1, 1)
コード例 #3
0
 def test_result_must_be_positive(self):
     with pytest.raises(ArithmeticError):
         date(1900, 1, -1)
コード例 #4
0
 def test_month_must_be_integer(self):
     with pytest.raises(TypeError):
         date(2016, '1', 1)
コード例 #5
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_yearfrac_basis_3(self):
     assert 7.304109589 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 3))
コード例 #6
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_year_regular(self):
     assert 39755 == date(2008, 11, 3)
コード例 #7
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_yearfrac_basis_3(self):
     self.assertAlmostEqual(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 3), 7.304109589)
コード例 #8
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_year_for_29_feb(self):
     self.assertEqual(date(2008, 2, 29), 39507)
コード例 #9
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_year_regular(self):
     self.assertEqual(date(2008, 11, 3), 39755)
コード例 #10
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_year_for_29_feb(self):
     self.assertEqual(date(2008, 2, 29), 39507)
コード例 #11
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_day_superior_to_365_change_year(self):
     self.assertEqual(date(2009, 1, 400), date(2010, 2, 4))
コード例 #12
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_month_superior_to_12_change_year(self):
     self.assertEqual(date(2009, 14, 1), date(2010, 2, 1))
コード例 #13
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_not_stricly_positive_day_substracts(self):
     self.assertEqual(date(2009, 1, -1), date(2008, 12, 30))
コード例 #14
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_not_stricly_positive_month_substracts(self):
     self.assertEqual(date(2009, -1, 1), date(2008, 11, 1))
コード例 #15
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_result_must_be_positive(self):
     with self.assertRaises(ArithmeticError):
         date(1900, 1, -1)
コード例 #16
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_not_stricly_positive_month_substracts(self):
     self.assertEqual(date(2009, -1, 1), date(2008, 11, 1))
コード例 #17
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_month_superior_to_12_change_year(self):
     self.assertEqual(date(2009, 14, 1), date(2010, 2, 1))
コード例 #18
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_yearfrac_basis_0(self):
     self.assertAlmostEqual(yearfrac(date(2008, 1, 1), date(2015, 4, 20)), 7.30277777777778)
コード例 #19
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_yearfrac_basis_1(self):
     self.assertAlmostEqual(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 1), 7.299110198)
コード例 #20
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_yearfrac_basis_1(self):
     self.assertAlmostEqual(yearfrac(date(2008, 1, 1), date(2015, 4, 20), 1), 7.299110198)
コード例 #21
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_day_superior_to_365_change_year(self):
     assert date(2009, 1, 400) == date(2010, 2, 4)
コード例 #22
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_yearfrac_basis_2(self):
     self.assertAlmostEqual(yearfrac(date(2008, 1, 1), date(2015, 4, 20), 2), 7.405555556)
コード例 #23
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_yearfrac_basis_1(self):
     assert 7.299110198 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 1))
コード例 #24
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_yearfrac_basis_3(self):
     self.assertAlmostEqual(yearfrac(date(2008, 1, 1), date(2015, 4, 20), 3), 7.304109589)
コード例 #25
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_yearfrac_inverted(self):
     assert yearfrac(date(2008, 1, 1), date(2015, 4, 20)) == pytest.approx(
         yearfrac(date(2015, 4, 20), date(2008, 1, 1)))
コード例 #26
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_yearfrac_basis_1(self):
     assert 7.299110198 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 1))
コード例 #27
0
 def test_year_must_be_positive(self):
     with pytest.raises(ValueError):
         date(-1, 1, 1)
コード例 #28
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_yearfrac_basis_2(self):
     assert 7.405555556 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 2))
コード例 #29
0
 def test_not_stricly_positive_day_substracts(self):
     assert date(2009, 1, -1) == date(2008, 12, 30)
コード例 #30
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_yearfrac_basis_3(self):
     assert 7.304109589 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 3))
コード例 #31
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_result_must_be_positive(self):
     with self.assertRaises(ArithmeticError):
         date(1900, 1, -1)
コード例 #32
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_yearfrac_basis_4(self):
     assert 7.302777778 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 4))
コード例 #33
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_not_stricly_positive_day_substracts(self):
     self.assertEqual(date(2009, 1, -1), date(2008, 12, 30))
コード例 #34
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_yearfrac_inverted(self):
     assert yearfrac(date(2008, 1, 1), date(2015, 4, 20)) == pytest.approx(
         yearfrac(date(2015, 4, 20), date(2008, 1, 1)))
コード例 #35
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_day_superior_to_365_change_year(self):
     self.assertEqual(date(2009, 1, 400), date(2010, 2, 4))
コード例 #36
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_values_can_str(self):
     assert date('2016', 1, 1) == date(2016, '1', 1) == date(2016, 1, '1')
コード例 #37
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_year_regular(self):
     self.assertEqual(date(2008, 11, 3), 39755)
コード例 #38
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_year_must_be_positive(self):
     assert NUM_ERROR == date(-1, 1, 1)
コード例 #39
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_yearfrac_basis_2(self):
     self.assertAlmostEqual(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 2), 7.405555556)
コード例 #40
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_year_must_have_less_than_10000(self):
     assert NUM_ERROR == date(10000, 1, 1)
コード例 #41
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_yearfrac_basis_4(self):
     self.assertAlmostEqual(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 4), 7.302777778)
コード例 #42
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_result_must_be_positive(self):
     assert NUM_ERROR == date(1900, 1, -1)
コード例 #43
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_year_for_29_feb(self):
     assert 39507 == date(2008, 2, 29)
コード例 #44
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_not_stricly_positive_month_substracts(self):
     assert date(2009, -1, 1) == date(2008, 11, 1)
コード例 #45
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_year_offset(self):
     zero = dt.datetime(1900, 1, 1) - dt.timedelta(2)
     assert (dt.datetime(1900, 1, 1) - zero).days == date(0, 1, 1)
     assert (dt.datetime(1900 + 1899, 1, 1) - zero).days == date(1899, 1, 1)
     assert (dt.datetime(1900 + 1899, 1, 1) - zero).days == date(1899, 1, 1)
コード例 #46
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_not_stricly_positive_day_substracts(self):
     assert date(2009, 1, -1) == date(2008, 12, 30)
コード例 #47
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_yearfrac_basis_2(self):
     assert 7.405555556 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 2))
コード例 #48
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_month_superior_to_12_change_year(self):
     assert date(2009, 14, 1) == date(2010, 2, 1)
コード例 #49
0
ファイル: test_excellib.py プロジェクト: fabiocs8/pycel
 def test_yearfrac_basis_4(self):
     assert 7.302777778 == pytest.approx(
         yearfrac(date(2008, 1, 1), date(2015, 4, 20), 4))
コード例 #50
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_day_superior_to_365_change_year(self):
     assert date(2009, 1, 400) == date(2010, 2, 4)
コード例 #51
0
 def test_year_must_be_integer(self):
     with pytest.raises(TypeError):
         date('2016', 1, 1)
コード例 #52
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_year_for_29_feb(self):
     assert 39507 == date(2008, 2, 29)
コード例 #53
0
 def test_day_must_be_integer(self):
     with pytest.raises(TypeError):
         date(2016, 1, '1')
コード例 #54
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_year_regular(self):
     assert 39755 == date(2008, 11, 3)
コード例 #55
0
 def test_year_must_have_less_than_10000(self):
     with pytest.raises(ValueError):
         date(10000, 1, 1)
コード例 #56
0
ファイル: test_excellib.py プロジェクト: dgorissen/pycel
 def test_year_offset(self):
     zero = dt.datetime(1900, 1, 1) - dt.timedelta(2)
     assert (dt.datetime(1900, 1, 1) - zero).days == date(0, 1, 1)
     assert (dt.datetime(1900 + 1899, 1, 1) - zero).days == date(1899, 1, 1)
     assert (dt.datetime(1900 + 1899, 1, 1) - zero).days == date(1899, 1, 1)
コード例 #57
0
 def test_not_stricly_positive_month_substracts(self):
     assert date(2009, -1, 1) == date(2008, 11, 1)
コード例 #58
0
ファイル: excellib.py プロジェクト: omalleyt12/pycel-1
 def test_year_must_have_less_than_10000(self):
     with self.assertRaises(ValueError):
         date(10000, 1, 1)
コード例 #59
0
 def test_month_superior_to_12_change_year(self):
     assert date(2009, 14, 1) == date(2010, 2, 1)
コード例 #60
0
ファイル: excellib.py プロジェクト: SergeBredin/pycel
 def test_year_must_be_positive(self):
     with self.assertRaises(ValueError):
         date(-1, 1, 1)