Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a python unit test framework that gives compact error output when comparing strings

Using the Java JUnit framework and comparing the strings "abcde" and "abde" you would get the error output 'expected:<...b[c]d...> but was: <...b[]d...>'

Using python unittest I get "abcde" != "abde" which is not all as useful if you are dealing with long strings.

So my question is: Is there a python unit test framework that gives the same compact output as JUnit for Java?

like image 868
Vegar Westerlund Avatar asked Jan 29 '26 13:01

Vegar Westerlund


1 Answers

The unittest2 package is a backport (to Python >= 2.4) of features that are native to the PyUnit (unittest) framework in Python 2.7.

It includes enhanced string comparison features. alt text http://www.voidspace.org.uk/python/articles/unittest2.shtml#unicode-string-comparison

like image 106
Paul McMillan Avatar answered Jan 31 '26 04:01

Paul McMillan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!