def test_003_constructor_year_day(self):
     for test_row in gregorian_test_data:
         year = test_row[2][0]
         month = test_row[2][1]
         day = test_row[2][2]
         doy = test_row[3]
         greg_yd = GregorianCalendar.year_day(year, doy)
         assert (greg_yd.year, greg_yd.month, greg_yd.day) == (year, month, day)
예제 #2
0
 def test_003_constructor_year_day(self):
     for test_row in gregorian_test_data:
         year = test_row[2][0]
         month = test_row[2][1]
         day = test_row[2][2]
         doy = test_row[3]
         greg_yd = GregorianCalendar.year_day(year, doy)
         assert (greg_yd.year, greg_yd.month, greg_yd.day) == (year, month,
                                                               day)
예제 #3
0
 def test_023_invalid_values_year_day(self):
     for year, day_count in ((1, 0), (1, -1), (1, 366), (4, 367)):
         with pytest.raises(ValueError):
             GregorianCalendar.year_day(year, day_count)
예제 #4
0
 def test_013_invalid_parameter_types_year_day(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         GregorianCalendar.year_day()
     with pytest.raises(TypeError):
         GregorianCalendar.year_day(1)
     with pytest.raises(TypeError):
         GregorianCalendar.year_day(1, 2, 3)
     for par in ("1", (1, ), [1], {1: 1}, (), [], {}, None):
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(par, 1)
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(1, par)
     # exception with invalid numeric types
     for par in (1.0, Fraction(1, 1), Decimal(1), 1j, 1 + 1j, INF, NAN):
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(par, 1)
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(1, par)
 def test_023_invalid_values_year_day(self):
     for year, day_count in ((1, 0), (1, -1), (1, 366), (4, 367)):
         with pytest.raises(ValueError):
             GregorianCalendar.year_day(year, day_count)
 def test_013_invalid_parameter_types_year_day(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         GregorianCalendar.year_day()
     with pytest.raises(TypeError):
         GregorianCalendar.year_day(1)
     with pytest.raises(TypeError):
         GregorianCalendar.year_day(1, 2, 3)
     for par in ("1", (1,), [1], {1: 1}, (), [], {}, None):
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(par, 1)
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(1, par)
     # exception with invalid numeric types
     for par in (1.0, Fraction(1, 1), Decimal(1), 1j, 1 + 1j, INF, NAN):
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(par, 1)
         with pytest.raises(TypeError):
             GregorianCalendar.year_day(1, par)