Mercurial > nosedjango
diff examples/project/zoo/models.py @ 0:ff263bdd455e
initial checkin
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Thu, 28 Aug 2008 09:44:43 -0400 |
parents | |
children | 8d0793b2358b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/project/zoo/models.py Thu Aug 28 09:44:43 2008 -0400 @@ -0,0 +1,45 @@ +""" +Module-level doctest. + + >>> Zoo + <class 'project.zoo.models.Zoo'> + >>> 1 + 1 + 2 +""" +from django.db import models + +# Create your models here. +class Zoo(models.Model): + """ + Class-level doctest + + >>> Zoo + <class 'project.zoo.models.Zoo'> + >>> 1 + 1 + 2 + >>> Zoo.objects.all() + [] + >>> z = Zoo(name='Bronx') + >>> z.save() + >>> z + <Zoo: Bronx> + >>> Zoo.objects.all() + [<Zoo: Bronx>] + """ + name = models.CharField(max_length=100) + + def __str__(self): + """ + Function in class test + >>> 1 + 2 + 3 + """ + return self.name + +def func(): + """ + Function-level test + >>> 1+3 + 4 + """ + pass