1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.

Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
This commit is contained in:
Claude Paroz
2012-06-07 18:08:47 +02:00
parent 706fd9adc0
commit 4a103086d5
401 changed files with 6647 additions and 6157 deletions

View File

@@ -1,3 +1,5 @@
from __future__ import unicode_literals
from django.contrib.localflavor.ar.forms import (ARProvinceSelect,
ARPostalCodeField, ARDNIField, ARCUITField)
@@ -7,7 +9,7 @@ from django.test import SimpleTestCase
class ARLocalFlavorTests(SimpleTestCase):
def test_ARProvinceSelect(self):
f = ARProvinceSelect()
out = u'''<select name="provincias">
out = '''<select name="provincias">
<option value="B">Buenos Aires</option>
<option value="K">Catamarca</option>
<option value="H">Chaco</option>
@@ -36,16 +38,16 @@ class ARLocalFlavorTests(SimpleTestCase):
self.assertHTMLEqual(f.render('provincias', 'A'), out)
def test_ARPostalCodeField(self):
error_format = [u'Enter a postal code in the format NNNN or ANNNNAAA.']
error_atmost = [u'Ensure this value has at most 8 characters (it has 9).']
error_atleast = [u'Ensure this value has at least 4 characters (it has 3).']
error_format = ['Enter a postal code in the format NNNN or ANNNNAAA.']
error_atmost = ['Ensure this value has at most 8 characters (it has 9).']
error_atleast = ['Ensure this value has at least 4 characters (it has 3).']
valid = {
'5000': '5000',
'C1064AAB': 'C1064AAB',
'c1064AAB': 'C1064AAB',
'C1064aab': 'C1064AAB',
'4400': '4400',
u'C1064AAB': 'C1064AAB',
'C1064AAB': 'C1064AAB',
}
invalid = {
'C1064AABB': error_atmost + error_format,
@@ -58,13 +60,13 @@ class ARLocalFlavorTests(SimpleTestCase):
self.assertFieldOutput(ARPostalCodeField, valid, invalid)
def test_ARDNIField(self):
error_length = [u'This field requires 7 or 8 digits.']
error_digitsonly = [u'This field requires only numbers.']
error_length = ['This field requires 7 or 8 digits.']
error_digitsonly = ['This field requires only numbers.']
valid = {
'20123456': '20123456',
'20.123.456': '20123456',
u'20123456': '20123456',
u'20.123.456': '20123456',
'20123456': '20123456',
'20.123.456': '20123456',
'20.123456': '20123456',
'9123456': '9123456',
'9.123.456': '9123456',
@@ -77,11 +79,11 @@ class ARLocalFlavorTests(SimpleTestCase):
self.assertFieldOutput(ARDNIField, valid, invalid)
def test_ARCUITField(self):
error_format = [u'Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.']
error_invalid = [u'Invalid CUIT.']
error_format = ['Enter a valid CUIT in XX-XXXXXXXX-X or XXXXXXXXXXXX format.']
error_invalid = ['Invalid CUIT.']
valid = {
'20-10123456-9': '20-10123456-9',
u'20-10123456-9': '20-10123456-9',
'20-10123456-9': '20-10123456-9',
'27-10345678-4': '27-10345678-4',
'20101234569': '20-10123456-9',
'27103456784': '27-10345678-4',
@@ -93,6 +95,6 @@ class ARLocalFlavorTests(SimpleTestCase):
'20-10123456-': error_format,
'20-10123456-5': error_invalid,
'27-10345678-1': error_invalid,
u'27-10345678-1': error_invalid,
'27-10345678-1': error_invalid,
}
self.assertFieldOutput(ARCUITField, valid, invalid)