def test_olddates(self): """ Check that we can convert dates older than 1901 """ self.assertEqual(dbf2date('18990506'), datetime.date(1899, 5, 6)) self.assertEqual(date2dbf(datetime.date(1899, 5, 6)), '18990506') self.assertEqual(str2dbf('06.05.1899'), '18990506') self.assertEqual(dbf2str('18990506'), '06.05.1899')
def test_dbf2date(self): self.assertEqual(dbf2date(''), None) self.assertEqual(dbf2date('None'), None) self.assertEqual(dbf2date(None), None) self.assertEqual(dbf2date('20060506'), datetime.date(2006, 5, 6)) self.assertEqual(dbf2date('0'), None) self.assertEqual(dbf2date('000'), None)