[1.2.X] Migrated empty doctests. Thanks to Alex Gaynor.
Backport of r13789 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13806 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
cbcdd408c0
commit
411f8dc0d6
@ -7,20 +7,6 @@ no fields.
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Empty(models.Model):
|
||||
pass
|
||||
|
||||
__test__ = {'API_TESTS':"""
|
||||
>>> m = Empty()
|
||||
>>> m.id
|
||||
>>> m.save()
|
||||
>>> m2 = Empty()
|
||||
>>> m2.save()
|
||||
>>> len(Empty.objects.all())
|
||||
2
|
||||
>>> m.id is not None
|
||||
True
|
||||
>>> existing = Empty(m.id)
|
||||
>>> existing.save()
|
||||
|
||||
"""}
|
||||
|
15
tests/modeltests/empty/tests.py
Normal file
15
tests/modeltests/empty/tests.py
Normal file
@ -0,0 +1,15 @@
|
||||
from django.test import TestCase
|
||||
|
||||
from models import Empty
|
||||
|
||||
|
||||
class EmptyModelTests(TestCase):
|
||||
def test_empty(self):
|
||||
m = Empty()
|
||||
self.assertEqual(m.id, None)
|
||||
m.save()
|
||||
m2 = Empty.objects.create()
|
||||
self.assertEqual(len(Empty.objects.all()), 2)
|
||||
self.assertTrue(m.id is not None)
|
||||
existing = Empty(m.id)
|
||||
existing.save()
|
Loading…
x
Reference in New Issue
Block a user