Example #1
0
 def test_date_comparator_dates_close_enough_with_custom_margin(self):
     library = APILibrary()
     date_one = datetime.datetime.strptime("2018-05-05T05:05:05", '%Y-%m-%dT%H:%M:%S')
     date_two = datetime.datetime.strptime("2018-05-05T03:05:05", '%Y-%m-%dT%H:%M:%S')
     unmatched = []
     library.date_comparator(date_one, date_two, "key", unmatched, "hours", 10)
     assert unmatched == []
Example #2
0
 def test_date_comparator_dates_close_enough_with_custom_margin_fail(self):
     library = APILibrary()
     date_one = datetime.datetime(2018, 5, 6, 5, 5, 5)
     date_two = datetime.datetime(2018, 5, 5, 3, 5, 5)
     unmatched = []
     library.date_comparator(date_one, date_two, "key", unmatched, "hours", 10)
     assert unmatched == [('------------------\nDates Not Close Enough\nKey: key',
                           'Expected: 2018-05-06 05:05:05', 'Actual: 2018-05-05 03:05:05')]