[Python-Dev] PEP: Frequently-requested additional features for the unittest module (original) (raw)

Ben Finney ben+python at benfinney.id.au
Wed Jul 16 04:05:53 CEST 2008


Scott Dial <scott+python-dev at scottdial.com> writes:

Why [introduce redundant test names]?

assertnotlessthan = assertgreaterthanorequal assertnotgreaterthan = assertlessthanorequal assertnotlessthanorequal = assertgreaterthan assertnotgreaterthanorequal = assertlessthan

To answer the question: The above tests are logically equivalent, but the failure message would be different, reporting failure in terms of what the caller wanted to test.

I se your point though. I'd like to see what others think on this issue.

Besides, assertnotgreaterthanorequal is god-awful-long, along with the complaints about PEP-8-ifying. I wonder if it would be better to abbreviate these names with the same name that was used for the attribute in the operator module. Let's not reinvent the wheel here..

Interesting. So you advocate collapsing the above eight tests into the following four:

assert_lt
assert_gt
assert_le
assert_ge

-- \ “I always had a repulsive need to be something more than | `\ human.” —David Bowie | o_) | Ben Finney



More information about the Python-Dev mailing list