Verifying assertion failures

Kalle Svensson kalle at gnupung.net
Sat May 19 11:43:32 EDT 2001


Sez Gustavo Niemeyer:
> Hello!!
> 
> I was just wondering, is there anyway of knowing what assertion
> has failed?
> 
> I mean, it'd be nice to have something like:
> 
> >>> try:
> ...   assert 0 == 1
> ... except AssertionError, e:
> ...   print e
> ...
> 0 == 1

>>> try:
...   assert 0 == 1, "0 == 1"
... except AssertionError, e:
...   print e
... 
0 == 1

http://www.python.org/doc/current/ref/assert.html

Peace,
  Kalle
-- 
Email: kalle at gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]




More information about the Python-list mailing list