Quote of the day

Ethan Furman ethan at stoneleaf.us
Wed May 18 12:05:31 EDT 2016


On 05/18/2016 08:35 AM, Thomas Mlynarczyk wrote:
> On 18/05/16 17:21, Ned Batchelder wrote:

>> Ideally, an empty test wouldn't be a success, but I'm not sure how
>> the test runner could determine that it was empty.  I guess it could
>> introspect the test function to see if it had any real code in it,
>> but I don't know of a test runner that does that.
>
> Simple: a function which does not produce at least one "failure" or
> "pass" does not test anything. No need to introspect the code. Just
> check if the total score of failures and passes has changed after the
> function was run.

Not so simple: I have tests that do nothing besides build objects.  If 
building the objects raises no errors the test passed.

Although, for the benefit of empty tests not passing I could add a 
do-nothing assert:

   self.assertTrue(created_obj)

(it's a do-nothing because if the object wasn't created the test would 
have already failed).

--
~Ethan~



More information about the Python-list mailing list