summaryrefslogtreecommitdiff
path: root/tests/regressiontests/null_fk/models.py
diff options
context:
space:
mode:
authorJustin Bronn <jbronn@gmail.com>2008-08-05 17:15:33 +0000
committerJustin Bronn <jbronn@gmail.com>2008-08-05 17:15:33 +0000
commitaa239e3e5405933af6a29dac3cf587b59a099927 (patch)
treeea2cbd139c9a8cf84c09e0b2008bff70e05927ef /tests/regressiontests/null_fk/models.py
parent45b73c9a4685809236f84046cc7ffd32a50db958 (diff)
downloaddjango-attic/gis.tar.gz
gis: Merged revisions 7981-8001,8003-8011,8013-8033,8035-8036,8038-8039,8041-8063,8065-8076,8078-8139,8141-8154,8156-8214 via svnmerge from trunk.archive/attic/gisattic/gis
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@8215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/null_fk/models.py')
-rw-r--r--tests/regressiontests/null_fk/models.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/regressiontests/null_fk/models.py b/tests/regressiontests/null_fk/models.py
index 1bc266c033..529dde5039 100644
--- a/tests/regressiontests/null_fk/models.py
+++ b/tests/regressiontests/null_fk/models.py
@@ -1,8 +1,5 @@
"""
-Regression tests for proper working of ForeignKey(null=True). Tests these bugs:
-
- * #7369: FK non-null after null relationship on select_related() generates an invalid query
-
+Regression tests for proper working of ForeignKey(null=True).
"""
from django.db import models
@@ -38,7 +35,8 @@ __test__ = {'API_TESTS':"""
# Starting from comment, make sure that a .select_related(...) with a specified
# set of fields will properly LEFT JOIN multiple levels of NULLs (and the things
-# that come after the NULLs, or else data that should exist won't).
+# that come after the NULLs, or else data that should exist won't). Regression
+# test for #7369.
>>> c = Comment.objects.select_related().get(id=1)
>>> c.post
<Post: First Post>
@@ -47,9 +45,11 @@ __test__ = {'API_TESTS':"""
None
>>> comments = Comment.objects.select_related('post__forum__system_info').all()
->>> [(c.id, c.post.id) for c in comments]
-[(1, 1), (2, None)]
->>> [(c.comment_text, c.post.title) for c in comments]
-[(u'My first comment', u'First Post'), (u'My second comment', None)]
+>>> [(c.id, c.comment_text, c.post) for c in comments]
+[(1, u'My first comment', <Post: First Post>), (2, u'My second comment', None)]
+
+# Regression test for #7530, #7716.
+>>> Comment.objects.select_related('post').filter(post__isnull=True)[0].post is None
+True
"""}