Verifying assertion failures
Gustavo Niemeyer
niemeyer at conectiva.com
Sat May 19 11:01:55 EDT 2001
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
Yes, I know it's possible to achieve the same results with something
like:
>>> def myassert(test):
... try:
... assert eval(test)
... except AssertionError:
... print test
...
>>> myassert("0 == 1")
0 == 1
But wouldn't the first be a nice addition?
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
More information about the Python-list
mailing list