[TIP] Unittest Changes

Ben Finney ben+python at benfinney.id.au
Mon Jul 28 20:12:25 PDT 2008


Robert Collins <robertc at robertcollins.net> writes:

> On Tue, 2008-07-29 at 01:30 +0300, Pekka Laukkanen wrote:
> > - Stand-alone asserts are available for unittest but also for
> > other tools (no need to re-implement the wheel every time).
> 
> I'm not sure why other tools would need to reimplement assertions;
> unless they testing tools - and then why not subclass TestCase?

My understanding is that some consider "subclass TestCase and deal
with its interface" is a higher barrier than "use a plain function
from a module in a test function you otherwise write in any way you
please", so the latter is more useful in many use cases.

> > - Asserts have PEP8-style names (and naming convention suggested
> > by BDFL).
> 
> This is nice I guess. (While the camelCase names are a bit jarring with
> the rest of python, they do fit with xUnit in nearly every other
> language I've found it ported to, which is a nice form of consistency).

I'd consider naming convention consistency *within* Python to be more
important than consistency with non-Python naming conventions.

-- 
 \      “Saying that Java is nice because it works on all OSes is like |
  `\     saying that anal sex is nice because it works on all genders” |
_o__)                                                —http://bash.org/ |
Ben Finney




More information about the testing-in-python mailing list