summaryrefslogtreecommitdiff
path: root/tests/modeltests/empty/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modeltests/empty/models.py')
-rw-r--r--tests/modeltests/empty/models.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/modeltests/empty/models.py b/tests/modeltests/empty/models.py
new file mode 100644
index 0000000000..c50878398d
--- /dev/null
+++ b/tests/modeltests/empty/models.py
@@ -0,0 +1,24 @@
+"""
+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
+
+API_TESTS = """
+>>> m = Empty()
+>>> m.id
+>>> m.save()
+>>> m2 = Empty()
+>>> m2.save()
+>>> len(Empty.objects.all())
+2
+>>> m.id is not None
+True
+
+"""