Kaydet (Commit) 8c356acf authored tarafından Aymeric Augustin's avatar Aymeric Augustin

[py3] Fixed test_utils tests of doctests.

üst 688678e7
...@@ -5,6 +5,7 @@ from django.forms import EmailField, IntegerField ...@@ -5,6 +5,7 @@ from django.forms import EmailField, IntegerField
from django.http import HttpResponse from django.http import HttpResponse
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.utils import six
from django.utils.unittest import skip from django.utils.unittest import skip
from .models import Person from .models import Person
...@@ -495,12 +496,6 @@ __test__ = {"API_TEST": r""" ...@@ -495,12 +496,6 @@ __test__ = {"API_TEST": r"""
>>> from django.utils.xmlutils import SimplerXMLGenerator >>> from django.utils.xmlutils import SimplerXMLGenerator
>>> from django.utils.six import StringIO >>> from django.utils.six import StringIO
>>> def produce_long():
... return 42L
>>> def produce_int():
... return 42
>>> def produce_json(): >>> def produce_json():
... return json.dumps(['foo', {'bar': ('baz', None, 1.0, 2), 'whiz': 42}]) ... return json.dumps(['foo', {'bar': ('baz', None, 1.0, 2), 'whiz': 42}])
...@@ -529,14 +524,6 @@ __test__ = {"API_TEST": r""" ...@@ -529,14 +524,6 @@ __test__ = {"API_TEST": r"""
... xml.endElement("bar") ... xml.endElement("bar")
... return stream.getvalue() ... 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 # JSON output is normalized for field order, so it doesn't matter
# which order json dictionary attributes are listed in output # which order json dictionary attributes are listed in output
>>> produce_json() >>> produce_json()
...@@ -560,3 +547,21 @@ __test__ = {"API_TEST": r""" ...@@ -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>' '<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
"""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment