summaryrefslogtreecommitdiff
path: root/tests/modeltests/basic
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2006-05-26 18:41:03 +0000
committerLuke Plant <L.Plant.98@cantab.net>2006-05-26 18:41:03 +0000
commit0c8ac0972c9b1a5af95d40334b83cf5f31d56331 (patch)
tree1274619d3ea7aac51806ae7bd9bbba89e06dd0af /tests/modeltests/basic
parentb63157c616104d19a92a7b9793693c73e4d047c5 (diff)
Made negative indexing on QuerySet instances raise an assertion error (previously
it just returned incorrect results). git-svn-id: http://code.djangoproject.com/svn/django/trunk@2992 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/basic')
-rw-r--r--tests/modeltests/basic/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/modeltests/basic/models.py b/tests/modeltests/basic/models.py
index 0470d6bc9b..f60c3777e7 100644
--- a/tests/modeltests/basic/models.py
+++ b/tests/modeltests/basic/models.py
@@ -283,6 +283,16 @@ Traceback (most recent call last):
...
AssertionError: Cannot combine queries once a slice has been taken.
+# Negative slices are not supported, due to database constraints.
+# (hint: inverting your ordering might do what you need).
+>>> Article.objects.all()[-1]
+Traceback (most recent call last):
+ ...
+AssertionError: Negative indexing is not supported.
+>>> Article.objects.all()[0:-5]
+Traceback (most recent call last):
+ ...
+AssertionError: Negative indexing is not supported.
# An Article instance doesn't have access to the "objects" attribute.
# That's only available on the class.