简体   繁体   中英

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?

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. 替代文字 http://www.voidspace.org.uk/python/articles/unittest2.shtml#unicode-string-comparison

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM