def test_date_to_str(self): date = str_to_date('2012-01-31 12:06:15') s = date_to_str(date) self.assertEqual(s, '2012-01-31 12:06:15') date = str_to_date('2002-01-31 12:06:40') s = date_to_str(date) self.assertEqual(s, '2002-01-31 12:06:40')
def test_str_to_date(self): date = str_to_date('2012-01-31 12:06:15.0') self.assertEqual(date.year, 2012) self.assertEqual(date.month, 1) self.assertEqual(date.day, 31) self.assertEqual(date.second, 15) date = str_to_date('2002-01-31 12:06:40') self.assertEqual(date.year, 2002) self.assertEqual(date.month, 1) self.assertEqual(date.day, 31) self.assertEqual(date.second, 40)