_all_ Python tests have got assertions backwards

It seems all Python tests have their expected and actual arguments flipped, resulting in incorrect messaging when the tests fail. For example, in the exercise “bob”, one of the answers is “Whatever.”. If however, the code returns “abc”, one of the failing tests is as follows.

FAILED    [ 40%]
bob/bob_test.py:96 (BobTest.test_non_question_ending_with_whitespace)
'Whatever.' != 'abc'

Expected :'abc'
Actual   :'Whatever.'

Note that this problem is not limited to a test, or even an exercise, it is true for all tests in the Python track.

Using Python 3.11.3 and pytest 7.4.0.

Previously discussed at Order of expected/actual values.

1 Like