Beispiel #1
0
 def test_020_invalid_values(self):
     for test_row in iso_invalid_data:
         year = test_row[0]
         week = test_row[1]
         day = test_row[2]
         with pytest.raises(TypeError):
             IsoCalendar.from_rata_die(year, week, day)
 def test_020_invalid_values(self):
     for test_row in iso_invalid_data:
         year = test_row[0]
         week = test_row[1]
         day = test_row[2]
         with pytest.raises(TypeError):
             IsoCalendar.from_rata_die(year, week, day)
Beispiel #3
0
 def test_005_constructor_rata_die(self):
     for test_row in iso_test_data:
         rd = test_row[0]
         year = test_row[1]
         week = test_row[2]
         day = test_row[3]
         iso_rd = IsoCalendar.from_rata_die(rd)
         assert iso_rd.year == year
         assert iso_rd.week == week
         assert iso_rd.day == day
 def test_005_constructor_rata_die(self):
     for test_row in iso_test_data:
         rd = test_row[0]
         year = test_row[1]
         week = test_row[2]
         day = test_row[3]
         iso_rd = IsoCalendar.from_rata_die(rd)
         assert iso_rd.year == year
         assert iso_rd.week == week
         assert iso_rd.day == day
Beispiel #5
0
 def test_015_invalid_parameter_types_rata_die(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         IsoCalendar.from_rata_die()
     with pytest.raises(TypeError):
         IsoCalendar.from_rata_die(1, 2)
     # exception with non-numeric types
     for par in ("1", (1, ), [1], {1: 1}, (), [], {}, None):
         with pytest.raises(TypeError):
             IsoCalendar.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):
             IsoCalendar.from_rata_die(par)
 def test_015_invalid_parameter_types_rata_die(self):
     # exception with none, two or four parameters
     with pytest.raises(TypeError):
         IsoCalendar.from_rata_die()
     with pytest.raises(TypeError):
         IsoCalendar.from_rata_die(1, 2)
     # exception with non-numeric types
     for par in ("1", (1,), [1], {1:1}, (), [], {}, None):
         with pytest.raises(TypeError):
             IsoCalendar.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):
             IsoCalendar.from_rata_die(par)