def test_good_year_datetime_output(self): """Ensure a good date is printed correctly)""" obj = awstats_reader.awstats_datetime('20110430184200') self.assertEqual(obj.strftime('%Y%m%d%H%M%S'), '20110430184200')
def test_year_zero_datetime_output(self): """Ensure the Awstats 'year zero' is printed correctly""" obj = awstats_reader.awstats_datetime('0') self.assertEqual(obj.strftime('%Y%m%d%H%M%S'), '0')
def test_8_digit_date_detection(self): """Ensure the AwstatsDate object is returned""" obj = awstats_reader.awstats_datetime('20091130') self.assertTrue(isinstance(obj, awstats_reader.AwstatsDate))
def test_year_year_zero_datetime_parse(self): """Ensure the Awstats 'year zero' is parsed correctly""" obj = awstats_reader.awstats_datetime('0') self.assertEqual(obj,datetime.datetime(1,1,1))
def test_8_digit_date(self): """Ensure date strings are being evaluated correctly""" obj = awstats_reader.awstats_datetime('20091130') dt = datetime.date(2009, 11, 30) self.assertEqual(obj, dt)