Commits

Anonymous committed 2aa9c5e

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

Comments (0)

Files changed (2)

tests/modeltests/empty/models.py

 
 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()
-
-"""}

tests/modeltests/empty/tests.py

+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()