summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-08-16 10:26:18 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-08-16 10:26:18 +0200
commit8c356acf2e6896759e6ca7a369f0b04766a928f3 (patch)
tree254d21afb2f2c7355d633cd4534287dbc971cc06
parent688678e7c091e4549777d8cc47e8984d5e672976 (diff)
[py3] Fixed test_utils tests of doctests.
-rw-r--r--tests/regressiontests/test_utils/tests.py33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/regressiontests/test_utils/tests.py b/tests/regressiontests/test_utils/tests.py
index f43a855a59..3749014372 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"""
'<foo bbb="2.0" aaa="1.0">Hello</foo><bar ddd="4.0" ccc="3.0"></bar>'
"""}
+
+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
+
+"""