[Python-Dev] PEP: Consolidating names in the unittest
module (original) (raw)
Stephen J. Turnbull stephen at xemacs.org
Wed Jul 16 00:20:40 CEST 2008
- Previous message: [Python-Dev] PEP: Consolidating names in the `unittest` module
- Next message: [Python-Dev] PEP: Consolidating names in the `unittest` module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ben Finney writes:
Removal of
assert*
names
Arguments in favour of retaining only the
assert*
names:
BDFL preference: The BDFL has stated [#vanrossum-1]_ a preference for the
assert*
names.Precedent: The Python standard library currently uses the
assert*
names by a roughly 8:1 majority over thefail*
names. (Counting unit tests in the py3k tree at 2008-07-15 [#pitrou-1]_.)An ad-hoc sampling of other projects that use
unittest
also demonstrates strong preference for use of theassert*
names [#bennetts-1]_.Positive admonition: The
assert*
names state the intent of how the code under test should behave, while thefail*
names are phrased in terms of how the code should not behave.
FWIW, I think these are fairly stated. So fairly that I'm surprised you haven't been persuaded! Nitpick: the second point is not just "precedent", there's an economic reason there too. Tests in the standard distribution which use the deprecated style will need to be converted. Steven d'Aprano claims this is nontrivial (and thus error- prone) in some cases. I haven't seen that claim denied, and it seems plausible to me.
PEP 8 names
Although
unittest
(and its predecessorPyUnit
) are intended to be familiar to users of other xUnit interfaces, there is no attempt at direct API compatibility since the only code that Python'sunittest
interfaces with is other Python code. The module is in the standard library and its names should all conform with PEP 8 [#PEP-8]_.
You should mention Raymond's concern that PEP 8 names are quite a bit longer.
- Previous message: [Python-Dev] PEP: Consolidating names in the `unittest` module
- Next message: [Python-Dev] PEP: Consolidating names in the `unittest` module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]