2006-06-08 08:13:52 +08:00
|
|
|
"""
|
|
|
|
Empty model tests
|
|
|
|
|
|
|
|
These test that things behave sensibly for the rare corner-case of a model with
|
|
|
|
no fields.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
class Empty(models.Model):
|
|
|
|
pass
|
|
|
|
|
2006-08-27 21:59:47 +08:00
|
|
|
__test__ = {'API_TESTS':"""
|
2006-06-08 08:13:52 +08:00
|
|
|
>>> m = Empty()
|
2006-06-12 20:49:14 +08:00
|
|
|
>>> m.id
|
2006-06-08 08:13:52 +08:00
|
|
|
>>> m.save()
|
2006-06-08 23:15:27 +08:00
|
|
|
>>> m2 = Empty()
|
|
|
|
>>> m2.save()
|
|
|
|
>>> len(Empty.objects.all())
|
|
|
|
2
|
2006-06-12 20:49:14 +08:00
|
|
|
>>> m.id is not None
|
|
|
|
True
|
2006-08-10 11:55:03 +08:00
|
|
|
>>> existing = Empty(m.id)
|
|
|
|
>>> existing.save()
|
2006-06-08 08:13:52 +08:00
|
|
|
|
2006-08-27 21:59:47 +08:00
|
|
|
"""}
|