Comment

Marius Gedminas

What Chris said, with the additional argument that the tests should be run with the same Python executable and options as real code, so if you use -O to run your app, you should do it to run your tests.

(Personally, I'm not convinced, and I've never used -O to run production applications.)

Also, when you do

assert actual_result == expected_result

you get no information about what the actual result was, while self.assertEqual() prints both arguments.

For completeness' sake I have to mention that there are test runners (py.test and, I think, nose with some option turned on) that do magic to display this even when you use an assert statement.