summaryrefslogtreecommitdiff
path: root/tests/modeltests/basic
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2012-07-26 18:58:10 +0100
committerAndrew Godwin <andrew@aeracode.org>2012-07-26 18:58:10 +0100
commit4a2e80fff44d0eb1856b593ac5f31ab1492b3e45 (patch)
tree9bc87a682dc488e6555792c1d4bb53f5f3cdc880 /tests/modeltests/basic
parent959a3f9791d780062c4efe8765404a8ef95e87f0 (diff)
parentab6cd1c839b136cbc94178da433b2e97ab7f6061 (diff)
Merge branch 'master' of github.com:django/django into schema-alteration
Conflicts: django/db/backends/postgresql_psycopg2/base.py
Diffstat (limited to 'tests/modeltests/basic')
-rw-r--r--tests/modeltests/basic/tests.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/modeltests/basic/tests.py b/tests/modeltests/basic/tests.py
index 3f00fb25fe..d96c60bbe8 100644
--- a/tests/modeltests/basic/tests.py
+++ b/tests/modeltests/basic/tests.py
@@ -5,6 +5,7 @@ from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields import Field, FieldDoesNotExist
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
+from django.utils.six import PY3
from django.utils.translation import ugettext_lazy
from .models import Article
@@ -321,17 +322,18 @@ class ModelTest(TestCase):
["<Article: Area man programs in Python>",
"<Article: Third article>"])
- # Slicing works with longs.
- self.assertEqual(Article.objects.all()[0L], a)
- self.assertQuerysetEqual(Article.objects.all()[1L:3L],
- ["<Article: Second article>", "<Article: Third article>"])
- self.assertQuerysetEqual((s1 | s2 | s3)[::2L],
- ["<Article: Area man programs in Python>",
- "<Article: Third article>"])
+ # Slicing works with longs (Python 2 only -- Python 3 doesn't have longs).
+ if not PY3:
+ self.assertEqual(Article.objects.all()[long(0)], a)
+ self.assertQuerysetEqual(Article.objects.all()[long(1):long(3)],
+ ["<Article: Second article>", "<Article: Third article>"])
+ self.assertQuerysetEqual((s1 | s2 | s3)[::long(2)],
+ ["<Article: Area man programs in Python>",
+ "<Article: Third article>"])
- # And can be mixed with ints.
- self.assertQuerysetEqual(Article.objects.all()[1:3L],
- ["<Article: Second article>", "<Article: Third article>"])
+ # And can be mixed with ints.
+ self.assertQuerysetEqual(Article.objects.all()[1:long(3)],
+ ["<Article: Second article>", "<Article: Third article>"])
# Slices (without step) are lazy:
self.assertQuerysetEqual(Article.objects.all()[0:5].filter(),