1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

[soc2010/test-refactor] updated empty modeltest to unittest

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/test-refactor@13377 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Paul McMillan 2010-06-22 02:56:53 +00:00
parent 85f024c2b1
commit 52a855fd37
2 changed files with 15 additions and 15 deletions

View File

@ -9,18 +9,3 @@ 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()
"""}

View File

@ -0,0 +1,15 @@
from django.test import TestCase
from models import Empty
class EmptyModelTestCase(TestCase):
def test_empty(self):
m = Empty()
self.assertEqual(m.id, None)
m.save()
m2 = Empty()
m2.save()
self.assertEqual(len(Empty.objects.all()), 2)
self.assertTrue(m.id is not None)
existing = Empty(m.id)
existing.save()