[py3] Fixed test_utils tests of doctests.
This commit is contained in:
parent
688678e7c0
commit
8c356acf2e
|
@ -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"""
|
||||||
>>> 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"""
|
||||||
... 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"""
|
||||||
'<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
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
Loading…
Reference in New Issue