def test_006_constructor_rata_die(self):
     for test_row in gregorian_test_data:
         rd = test_row[0]
         year = test_row[2][0]
         month = test_row[2][1]
         day = test_row[2][2]
         greg_rd = GregorianCalendar.from_rata_die(rd)
         assert (greg_rd.year, greg_rd.month, greg_rd.day) == (year, month, day)
Example #2
0
 def test_006_constructor_rata_die(self):
     for test_row in gregorian_test_data:
         rd = test_row[0]
         year = test_row[2][0]
         month = test_row[2][1]
         day = test_row[2][2]
         greg_rd = GregorianCalendar.from_rata_die(rd)
         assert (greg_rd.year, greg_rd.month, greg_rd.day) == (year, month,
                                                               day)
Example #3
0
 def test_016_invalid_parameter_types_rata_die(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         GregorianCalendar.from_rata_die()
     with pytest.raises(TypeError):
         GregorianCalendar.from_rata_die(1, 2)
     # exception with non-numeric types
     for par in ("1", (1, ), [1], {1: 1}, (), [], {}, None):
         with pytest.raises(TypeError):
             GregorianCalendar.from_rata_die(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.from_rata_die(par)
 def test_016_invalid_parameter_types_rata_die(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         GregorianCalendar.from_rata_die()
     with pytest.raises(TypeError):
         GregorianCalendar.from_rata_die(1, 2)
     # exception with non-numeric types
     for par in ("1", (1,), [1], {1: 1}, (), [], {}, None):
         with pytest.raises(TypeError):
             GregorianCalendar.from_rata_die(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.from_rata_die(par)