diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py index f43a855a590..37490143724 100644 --- a/tests/regressiontests/test_utils/tests.py +++ b/tests/regressiontests/test_utils/tests.py @@ -5,6 +5,7 @@ from django.forms import EmailField, IntegerField from django.http import HttpResponse from django.template.loader import render_to_string from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature +from django.utils import six from django.utils.unittest import skip from .models import Person @@ -495,12 +496,6 @@ __test__ = {"API_TEST": r""" >>> from django.utils.xmlutils import SimplerXMLGenerator >>> from django.utils.six import StringIO ->>> def produce_long(): -... return 42L - ->>> def produce_int(): -... return 42 - >>> def produce_json(): ... return json.dumps(['foo', {'bar': ('baz', None, 1.0, 2), 'whiz': 42}]) @@ -529,14 +524,6 @@ __test__ = {"API_TEST": r""" ... xml.endElement("bar") ... return stream.getvalue() -# Long values are normalized and are comparable to normal integers ... ->>> produce_long() -42 - -# ... and vice versa ->>> produce_int() -42L - # JSON output is normalized for field order, so it doesn't matter # which order json dictionary attributes are listed in output >>> produce_json() @@ -560,3 +547,21 @@ __test__ = {"API_TEST": r""" 'Hello' """} + +if not six.PY3: + __test__["API_TEST"] += """ +>>> def produce_long(): +... return 42L + +>>> def produce_int(): +... return 42 + +# Long values are normalized and are comparable to normal integers ... +>>> produce_long() +42 + +# ... and vice versa +>>> produce_int() +42L + +"""