How to parameterize unittests

Chris Angelico rosuav at gmail.com
Fri Apr 15 13:51:17 EDT 2016


On Sat, Apr 16, 2016 at 2:47 AM, Steven D'Aprano <steve at pearwood.info> wrote:
> If the tests for your AVL tree and it's subclasses are *identical*, then
> what's the point of the subclasses?

If the tree classes all have the same API but different performance
trade-offs, it would make sense to use all the same tests to make sure
their behaviours are correct. But if your module's purpose is to offer
a variety of tree classes, its tests should be designed around
parameterization. Refactoring the code would be the correct behaviour.

ChrisA



More information about the Python-list mailing list