0
|
1 """
|
|
2 Module-level doctest.
|
|
3
|
|
4 >>> Zoo
|
|
5 <class 'project.zoo.models.Zoo'>
|
|
6 >>> 1 + 1
|
|
7 2
|
|
8 """
|
|
9 from django.db import models
|
|
10
|
|
11 # Create your models here.
|
|
12 class Zoo(models.Model):
|
|
13 """
|
|
14 Class-level doctest
|
|
15
|
|
16 >>> Zoo
|
|
17 <class 'project.zoo.models.Zoo'>
|
|
18 >>> 1 + 1
|
|
19 2
|
|
20 >>> Zoo.objects.all()
|
|
21 []
|
|
22 >>> z = Zoo(name='Bronx')
|
|
23 >>> z.save()
|
|
24 >>> z
|
|
25 <Zoo: Bronx>
|
|
26 >>> Zoo.objects.all()
|
|
27 [<Zoo: Bronx>]
|
|
28 """
|
|
29 name = models.CharField(max_length=100)
|
|
30
|
|
31 def __str__(self):
|
|
32 """
|
|
33 Function in class test
|
|
34 >>> 1 + 2
|
|
35 3
|
|
36 """
|
|
37 return self.name
|
|
38
|
|
39 def func():
|
|
40 """
|
|
41 Function-level test
|
|
42 >>> 1+3
|
|
43 4
|
|
44 """
|
|
45 pass
|