def test_captured_pattern_last_weekday(self): input_text = 'Last monday' parser = parsing.datetime_parsing(input_text) self.assertIn(input_text, parser[0]) self.assertEqual( parser[0][1].strftime('%d-%m-%y'), parsing.previous_week_day(self.base_date, 0).strftime('%d-%m-%y')) self.assertEqual(len(parser), 1)
def test_captured_pattern_last_weekday(self): input_text = 'Last monday' parser = parsing.datetime_parsing(input_text) self.assertIn(input_text, parser[0]) self.assertEqual( parser[0][1].strftime('%d-%m-%y'), parsing.previous_week_day(self.base_date, 0).strftime('%d-%m-%y') ) self.assertEqual(len(parser), 1)
def test_previous_week_day(self): base_date = datetime(2016, 12, 14, 10, 10, 52, 85280) weekday = 2 # Wednesday result = parsing.previous_week_day(base_date, weekday) self.assertEqual(result, datetime(2016, 12, 7, 10, 10, 52, 85280))
def test_previous_week_day(self): base_date = datetime(2016, 12, 14, 10, 10, 52, 85280) weekday = 2 # Wednesday result = parsing.previous_week_day(base_date, weekday) self.assertEqual(result, datetime(2016, 12, 7, 10, 10, 52, 85280))