Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56699
| Date | 2013-10-11 10:46 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: Skipping decorators in unit tests |
| References | <52573BED.40305@nedbatchelder.com> <mailman.978.1381459605.18130.python-list@python.org> <roy-11309E.23014310102013@news.panix.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1011.1381516410.18130.python-list@python.org> (permalink) |
On 10/10/2013 08:01 PM, Roy Smith wrote: > On 10Oct2013 19:44, Ned Batchelder <ned@nedbatchelder.com> wrote: >>> I have to admit I'm having a hard time understanding why you'd need >>> to test the undecorated functions. After all, the undecorated >>> functions aren't available to anyone. All that matters is how they >>> behave with the decorators. > > In article <mailman.978.1381459605.18130.python-list@python.org>, > Cameron Simpson <cs@zip.com.au> wrote: >> If the undecorated function is buggy, the decorated function will >> be buggy. But the bug will be harder to resolve, and if you're >> especially lucky the decorator will often-but-not-always conceal >> the bug in the inner function. > > And there lies the fundamental white-box vs. black-box testing conundrum. > > The black-box camp (whose flag Ned is flying) says, "There is an exposed > interface which accepts certain inputs and promises certain outputs. > That's all you know, that's all you ever can know, and that's all you > should ever want to know. The interface is constant. The guts can > change without notice". That's a perfectly valid philosophy. > > The white-box camp (under which banner Cameron rides) says, "There's a > lot of neat stuff under the covers, and I can do a better, faster, and > more complete testing job if I take advantage of my knowledge of what's > under the kimono". That, too, is a valid philosophy. Some tests can also be done much more easily with white-box. Imagine an edge case which takes an exact that requires an exact, seldom used, sequence of events because an internal bug is usually counteracted by the rest of the system, except in some small number of cases. Directly testing the internal piece directly for the bug can be much easier than setting up the long and involved test. -- ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Skipping decorators in unit tests Cameron Simpson <cs@zip.com.au> - 2013-10-11 13:22 +1100
Re: Skipping decorators in unit tests Roy Smith <roy@panix.com> - 2013-10-10 23:01 -0400
Re: Skipping decorators in unit tests Ethan Furman <ethan@stoneleaf.us> - 2013-10-11 10:46 -0700
csiph-web