Comment

Dan Lepage

You've misplaced your parentheses:

>>> assert False, ('This is '
... 'a long message that requires me to use '
... 'several lines to write it down.')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AssertionError: This is a long message that requires me to use several lines to write it down.

Parent comment

Doug Latornell

As others have mentioned, the convenience of self.assertEqual() generating a nice, useful message is a strong reason for using self.assertEqual() in my mind. However, the real deal-breaker for pure Python asserts is what happens if you use parentheses in an assert statement: Python 2.5.1 (r251:54863, Jul 23 2008, 11:00:16) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> assert False, "a short message" Traceback (most recent call last): File "", line 1, in AssertionError: a short message >>> assert (False, ... "a long message that needs more than 1 line") >>>