In the example, animals would be the app modules which contains a models.py
file and/or tests.py. "classify" would be a function in either models.py
or tests.py with a doctest string as the comment.
$ ./manage.py test animals.Bear
The above would run the doctest comment on the class Bear in models.py for
the animals package.
$ ./manage.py test animals.Bear.growl
The above would run the doctest comment of the method "growl" in the class
Bear in models.py for the animals package.
$ ./manage.py test animals.myfunc
The above would run the doctest comment of the function "myfunc" in
models.py for the animals package.
You'd specify your doctests as comments on classes, class methods or
functions in either models.py or tests.py;
class Bear(models.Model):
"""
>>> a = 1
>>> a
1
"""
def growl(self):
"""
>>> a = 1
>>> a
1
"""
pass
def myfunc():
"""
>>> a = 1
>>> a
1
"""
pass
On Thursday, January 3, 2013 3:17:04 PM UTC-5, Bernard Kuehlhorn wrote:
>
> In https://docs.djangoproject.com/en/1.4/topics/testing/ , individual
> tests can be run. It works well for unit tests in tests.py. It should work
> for doctest in model.py. I can not understand how to specify a doctest.
>
> $ ./manage.py test animals.classify
>
>
> Thanks,
> ben
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/fUzfj-9UV1kJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.