Time Calculator

Hello everyone.
I suppose, I’ve found a bug in the tests or I can’t understand…
I got an error:
Traceback (most recent call last):
File “/home/runner/boilerplate-time-calculator/test_module.py”, line 35, in test_two_days_later
self.assertEqual(actual, expected, ‘Expected calling “add_time()” with “11:59 PM”, “24:05” to return “12:04 AM (2 days later)”’)
AssertionError: ‘0:04 AM (2 days later)’ != ‘12:04 AM (2 days later)’

  • 0:04 AM (2 days later)
    ? ^
  • 12:04 AM (2 days later)
    ? ^^
    : Expected calling “add_time()” with “11:59 PM”, “24:05” to return “12:04 AM (2 days later)”

======================================================================
FAIL: test_two_days_later_with_day (test_module.UnitTests)

Traceback (most recent call last):
File “/home/runner/boilerplate-time-calculator/test_module.py”, line 60, in test_two_days_later_with_day
self.assertEqual(actual, expected, ‘Expected calling “add_time()” with “11:59 PM”, “24:05”, “Wednesday” to return “12:04 AM, Friday (2 days later)”’)
AssertionError: ‘0:04 AM, Friday (2 days later)’ != ‘12:04 AM, Friday (2 days later)’

  • 0:04 AM, Friday (2 days later)
    ? ^
  • 12:04 AM, Friday (2 days later)
    ? ^^
    : Expected calling “add_time()” with “11:59 PM”, “24:05”, “Wednesday” to return “12:04 AM, Friday (2 days later)”

    the question is how can be 12:04 AM?

No bug (in the tests), That’s how the midnight hour is expressed in 12-hour format time, which would be 0:04 in 24-hour format time. “0:04 AM” is wrong in both systems I believe as a zero hour does not exist in 12-hour and AM is implied in 24-hour.

I can help more but I’ll need to see your entire code. I think I know the issue.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.