Esempio n. 1
0
 def testMonthday_known(self):
     date = DvDate([1999, 10, 20])
     self.assertEqual(False, date.is_partial())
     self.assertEqual(True, date.month_known())
     self.assertEqual(True, date.day_known())
     date = DvDate("204611")
     self.assertEqual(True, date.is_partial())
     self.assertEqual(True, date.month_known())
     self.assertEqual(False, date.day_known())
     date = DvDate([2020])
     self.assertEqual(True, date.is_partial())
     self.assertEqual(False, date.month_known())
     self.assertEqual(False, date.day_known())
Esempio n. 2
0
 def testGetYearMonthDay(self):
     date = DvDate([1999, 10, 20])
     self.assertEqual(1999, date.year())
     self.assertEqual(10, date.month())
     self.assertEqual( 20, date.day())
     date = DvDate("2002-09-20")
     self.assertEqual(2002, date.year())
     self.assertEqual(9, date.month())
     self.assertEqual(20, date.day())
     date = DvDate("20060107")
     self.assertEqual(2006, date.year())
     self.assertEqual(1, date.month())
     self.assertEqual(7, date.day())
     date = DvDate("204611")
     self.assertEqual(2046, date.year())
     self.assertEqual(11, date.month())
     self.assertEqual(-1, date.day())
     date = DvDate([1988, 3])
     self.assertEqual(1988, date.year())
     self.assertEqual(3, date.month())
     self.assertEqual(-1, date.day())
     date = DvDate("2020")
     self.assertEqual(2020, date.year())
     self.assertEqual(-1, date.month())
     self.assertEqual(-1, date.day())