Mercurial > nosedjango
annotate examples/project/zoo/models.py @ 11:9af906a73061
added a 404.html file and updated the testcases to run against Django svn rev 8693 (post 1.0b1)
author | Victor Ng <victor@monkeybean.ca> |
---|---|
date | Fri, 29 Aug 2008 00:46:22 -0400 |
parents | 8d0793b2358b |
children |
rev | line source |
---|---|
6
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
1 from django.db import models |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
2 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
3 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
4 Module-level doctest. |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
5 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
6 >>> Zoo |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
7 <class 'project.zoo.models.Zoo'> |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
8 >>> 1 + 1 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
9 2 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
10 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
11 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
12 def func(): |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
13 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
14 Function-level test |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
15 >>> 1+3 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
16 4 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
17 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
18 pass |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
19 # Create your models here. |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
20 class Zoo(models.Model): |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
21 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
22 Class-level doctest |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
23 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
24 >>> Zoo |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
25 <class 'project.zoo.models.Zoo'> |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
26 >>> 1 + 1 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
27 2 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
28 >>> Zoo.objects.all() |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
29 [] |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
30 >>> z = Zoo(name='Bronx') |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
31 >>> z.save() |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
32 >>> z |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
33 <Zoo: Bronx> |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
34 >>> Zoo.objects.all() |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
35 [<Zoo: Bronx>] |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
36 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
37 name = models.CharField(max_length=100) |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
38 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
39 def __str__(self): |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
40 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
41 Function in class test |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
42 >>> 1 + 2 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
43 3 |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
44 """ |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
45 return self.name |
8d0793b2358b
update testapp to django 1.0b1
Victor Ng <victor@monkeybean.ca>
parents:
0
diff
changeset
|
46 |