Exemplo n.º 1
0
 def test_invalid_month(self):
     self.assertRaises(ValueError, lambda: Month(0))
     self.assertRaises(ValueError, lambda: Month(13))
Exemplo n.º 2
0
 def test_is_last(self):
     self.assertFalse(Month(1).is_last())
     self.assertTrue(Month(12).is_last())
Exemplo n.º 3
0
 def test_get_last_day(self):
     self.assertEqual(Month(1).get_last_day(), 31)
     self.assertEqual(Month(2).get_last_day(), 28)
     self.assertEqual(Month(2).get_last_day(year=Year(1991)), 28)
     self.assertEqual(Month(2).get_last_day(year=Year(1992)), 29)
     self.assertEqual(Month(3).get_last_day(), 31)
     self.assertEqual(Month(4).get_last_day(), 30)
     self.assertEqual(Month(5).get_last_day(), 31)
     self.assertEqual(Month(6).get_last_day(), 30)
     self.assertEqual(Month(7).get_last_day(), 31)
     self.assertEqual(Month(8).get_last_day(), 31)
     self.assertEqual(Month(9).get_last_day(), 30)
     self.assertEqual(Month(10).get_last_day(), 31)
     self.assertEqual(Month(11).get_last_day(), 30)
     self.assertEqual(Month(12).get_last_day(), 31)
Exemplo n.º 4
0
 def test_gt(self):
     self.assertGreater(Month(2), Month(1))
Exemplo n.º 5
0
 def test_ge(self):
     self.assertGreaterEqual(Month(2), Month(1))
     self.assertGreaterEqual(Month(2), Month(2))
Exemplo n.º 6
0
 def test_le(self):
     self.assertLessEqual(Month(1), Month(2))
     self.assertLessEqual(Month(2), Month(2))
Exemplo n.º 7
0
 def test_lt(self):
     self.assertLess(Month(1), Month(2))
Exemplo n.º 8
0
 def test_ne(self):
     self.assertNotEqual(Month(1), Month(2))
Exemplo n.º 9
0
 def test_eq(self):
     self.assertEqual(Month(1), Month(1))
Exemplo n.º 10
0
 def test_is_last(self):
     self.assertFalse(Day(1).is_last())
     self.assertTrue(Day(31).is_last())
     self.assertTrue(Day(28).is_last(month=Month(2)))
     self.assertTrue(Day(29).is_last(month=Month(2), year=Year(2020)))