How to parameterize unittests

Michael Selik michael.selik at gmail.com
Fri Apr 15 06:05:28 EDT 2016


On Fri, Apr 15, 2016, 11:16 AM Steven D'Aprano <steve at pearwood.info> wrote:

> On Fri, 15 Apr 2016 06:20 pm, Antoon Pardon wrote:
>
> >>> I see, that's going to be a lot of cut & pastes.
>
> (3) In your editor, run a global Find and Replace "avltree -> self.tree".
> You will need to inspect each one rather than do it automatically.
> Obviously you need to avoid changing the "tree = avltree" class attribute,
> and any import lines, but probably everything else should change.
>

There's probably some context around uses of avltree that should be
replaced. Perhaps a trailing dot: "avltree." replace with "self.tree." so
imports and assignments are ignored.

Also, your other, very helpful steps should minimize the trial and error
aspects of global find-replace. I wouldn't feel obligated to visually
inspect each one -- not on my first try, anyway.

>



More information about the Python-list mailing list