[Python-Dev] PEP: Frequently-requested additional features for the unittest
module (original) (raw)
Scott Dial scott at scottdial.com
Wed Jul 16 04:27:59 CEST 2008
- Previous message: [Python-Dev] PEP: Frequently-requested additional features for the `unittest` module
- Next message: [Python-Dev] PEP: Frequently-requested additional features for the `unittest` module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ben Finney wrote:
Scott Dial <scott+python-dev at scottdial.com> writes:
Why [introduce redundant test names]? 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 can see how this argument makes sense, and is distinct from the fail* vs. assert* discussion. As you say, I'm interested what other think about this.
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: assertlt assertgt assertle assertge
I would argue to go even further:
assertEqual = assert_eq assertAlmostEqual = assert_almost_eq assertNotEqual = assert_ne assertNotAlmostEqual = assert_almost_ne
I'm not sure if there are others, but using the same abbreviations from operator is consistent and readable and short, in my opinion.
-- Scott Dial scott at scottdial.com scodial at cs.indiana.edu
- Previous message: [Python-Dev] PEP: Frequently-requested additional features for the `unittest` module
- Next message: [Python-Dev] PEP: Frequently-requested additional features for the `unittest` module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]