Skip to content

Commit 52a855f

Browse files
committed
[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
1 parent 85f024c commit 52a855f

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tests/modeltests/empty/models.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,3 @@
99

1010
class Empty(models.Model):
1111
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-
"""}

tests/modeltests/empty/tests.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from django.test import TestCase
2+
3+
from models import Empty
4+
5+
class EmptyModelTestCase(TestCase):
6+
def test_empty(self):
7+
m = Empty()
8+
self.assertEqual(m.id, None)
9+
m.save()
10+
m2 = Empty()
11+
m2.save()
12+
self.assertEqual(len(Empty.objects.all()), 2)
13+
self.assertTrue(m.id is not None)
14+
existing = Empty(m.id)
15+
existing.save()

0 commit comments

Comments
 (0)