Thursday, December 8, 2011

Re: documentation patch questions

On Fri, Dec 9, 2011 at 9:58 AM, Annie <anniem2@gmail.com> wrote:
> Thanks for the feedback, Russ. :) I've created the ticket and
> submitted the patch. It's ticket #17364.

Thanks! The patch looks good; the only thing preventing me from
marking it ready for checkin is the discussion below about something
else you may want to add to the patch.

>> Giving the test a docstring that will be used by the test runner
>> verbose/error output would also be a good idea.
>
> I'm still learning the unittest framework, so I'm not sure exactly how
> to clearly phrase what it's doing, but I'll give it a shot. *g* Do you
> mean something like:
>
> '''
> AnimalTestCase creates several animal objects and uses assertEqual
> to verify that the results from speak() match the expected results.
> '''

Close, but probably a little verbose. All you're looking for is a 1
line expression of what is being tested. Aside from the basic
explanatory benefit, the docstring is used when you run the test suite
in verbose mode. If you run Django's test suite with -v 2, you'll see
what I mean. Without a docstring, you will see statements like:

test_can_speak (myapp.AnimalTestCase)... ok

but if you have a docstring on your test method:

def test_animals_can_speak(self):
"Animals that can speak are correctly identified"

The verbose output is a little more humane:

Animals that can speak are correctly identified... ok

Long comments aren't required; you just need to provide something that
can be answered "OK".

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate