Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4418
| X-FeedAbuse | http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.16.109 |
|---|---|
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!nospam.fr.eu.org!usenet-fr.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail |
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: skipping one unittest assertion? |
| References | <roy-880487.10134901052011@news.panix.com> <87wriah4qg.fsf@benfinney.id.au> <roy-1458D0.11552901052011@news.panix.com> |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| Date | Mon, 02 May 2011 07:45:26 +1000 |
| Message-ID | <87k4eagknd.fsf@benfinney.id.au> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:uHfRHaO9ELGy/cH0cVCupX/wWcY= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 29 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | cb4ab83a.news.astraweb.com |
| X-Trace | DXC=@?82W9B:]P`JRZZkg^aP1jL?0kYOcDh@j7^o:UA4R?ceG;jTe9??mMi]G;2>V^?kWcbEW9A[5UK?eNZ[SL`C\KgcAERDGBfL:Tg |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:4418 |
Show key headers only | View raw
Roy Smith <roy@panix.com> writes: > Ben Finney <ben+python@benfinney.id.au> wrote: > > > Each test case should be testing one thing: if it fails, it should be > > for exactly one reason. > > Well, yeah, that's certainly the XP/unit-test doctrine. In practice > however, tests often get written as "do a bunch of stuff to get some > result, then make a bunch of assertions about that result". And the result is an increasingly-difficult maintenance burden for the test suite, as you've discovered. > Sure, you could make each of those assertions a distinct method, and > factor the "do a bunch of stuff" into setUp(). Which probably means > factoring those methods out into a new TestCase subclass. At some > point, however practicality trumps doctrine. Yet practicality, i.e. making your test cases manageable, is exactly what you don't have with your current approach. I'm not quoting doctrine at you; I'm saying that *because of problems like you're encountering*, you should refactor your test cases to do one test per case. -- \ “Absurdity, n. A statement or belief manifestly inconsistent | `\ with one's own opinion.” —Ambrose Bierce, _The Devil's | _o__) Dictionary_, 1906 | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
skipping one unittest assertion? Roy Smith <roy@panix.com> - 2011-05-01 10:13 -0400
Re: skipping one unittest assertion? Ben Finney <ben+python@benfinney.id.au> - 2011-05-02 00:31 +1000
Re: skipping one unittest assertion? Roy Smith <roy@panix.com> - 2011-05-01 11:55 -0400
Re: skipping one unittest assertion? Ben Finney <ben+python@benfinney.id.au> - 2011-05-02 07:45 +1000
Re: skipping one unittest assertion? "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-05-01 18:14 +0000
Re: skipping one unittest assertion? Roy Smith <roy@panix.com> - 2011-05-01 14:16 -0400
Re: skipping one unittest assertion? Chris Angelico <rosuav@gmail.com> - 2011-05-02 06:51 +1000
csiph-web