def test_do_date(self): now = date(2010, 11, 11) date_filter = fil.do_date(now) self.assertEqual('2010-11-11 - Thursday', date_filter) self.assertNotEqual('2010-11-12 - Thursday', date_filter) date_filter2 = fil.do_date(None) self.assertEqual('', date_filter2)
def test_do_date(self): # Without a datetime result_date = filters.do_date(None) self.assertEqual('', result_date) # With datetime and without a date format result_date = filters.do_date(datetime(2014, 4, 10, 13, 11, 35)) self.assertEqual('2014-04-10 - Thursday', result_date) # With datetime and a date format result_date = filters.do_date(datetime(2014, 4, 10, 13, 11, 35), '%d-%m %H:%M:%S') self.assertEqual('10-04 13:11:35', result_date) self.assertNotEqual('2014-04-10 - Thursday', result_date)
def testDo_date(self): fecha = filters.do_date(datetime(1990, 07, 01, 07, 06, 00)) self.assertEqual(fecha, '1990-07-01 - Sunday') self.assertNotEqual(fecha, '1990-07-01 - Sunday at 7:06am')
def testDo_dateNone(self): fecha = filters.do_date(None) self.assertEqual(fecha, '')
def test_date_not_none(self): now = datetime(2010, 11, 11, 13, 00, 00) fechadate = filters.do_date(now) self.assertNotEqual(fechadate, '2010-11-11 - Thursday at 1:00pm') self.assertEqual(fechadate, '2010-11-11 - Thursday')
def test_date_none(self): fechadate = filters.do_date(None) self.assertEqual(fechadate, '')
def testDateNotEmpty(self): date = datetime(2014, 1, 23, 9, 00, 00) result = filters.do_date(date) self.assertEqual(result, '2014-01-23 - Thursday')
def testDateEmpty(self): result = filters.do_date(None) self.assertEqual(result, '')