Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4394

Re: skipping one unittest assertion?

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>
Date 2011-05-02 00:31 +1000
Message-ID <87wriah4qg.fsf@benfinney.id.au> (permalink)
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


Roy Smith <roy@panix.com> writes:

> There's one particular assertion in a test method which depends on 
> production code that hasn't been written yet.  I could factor that out 
> into its own test methods and @skip that, but it would be cleaner to be 
> able to mark the particular assertion.

I think that's backward. If there are multiple conditions to assert,
then it's much cleaner to put them in distinct test case methods.

Each test case should be testing one thing: if it fails, it should be
for exactly one reason.

-- 
 \     “When people believe that they have absolute knowledge, with no |
  `\     test in reality, this [the Auschwitz crematorium] is how they |
_o__)             behave.” —Jacob Bronowski, _The Ascent of Man_, 1973 |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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