|
Revision 6813, 397 bytes
(checked in by mtredinnick, 11 months ago)
|
Fixed #6068 -- Updated docstrings in model tests to make the documentation
examples correct. Thanks Wang Chun.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
""" |
|---|
| 2 |
40. Empty model tests |
|---|
| 3 |
|
|---|
| 4 |
These test that things behave sensibly for the rare corner-case of a model with |
|---|
| 5 |
no fields. |
|---|
| 6 |
""" |
|---|
| 7 |
|
|---|
| 8 |
from django.db import models |
|---|
| 9 |
|
|---|
| 10 |
class Empty(models.Model): |
|---|
| 11 |
pass |
|---|
| 12 |
|
|---|
| 13 |
__test__ = {'API_TESTS':""" |
|---|
| 14 |
>>> m = Empty() |
|---|
| 15 |
>>> m.id |
|---|
| 16 |
>>> m.save() |
|---|
| 17 |
>>> m2 = Empty() |
|---|
| 18 |
>>> m2.save() |
|---|
| 19 |
>>> len(Empty.objects.all()) |
|---|
| 20 |
2 |
|---|
| 21 |
>>> m.id is not None |
|---|
| 22 |
True |
|---|
| 23 |
>>> existing = Empty(m.id) |
|---|
| 24 |
>>> existing.save() |
|---|
| 25 |
|
|---|
| 26 |
"""} |
|---|