Ticket #7463: 7463-failingtests.diff

File 7463-failingtests.diff, 1.7 KB (added by Karen Tracey, 13 years ago)
  • django/contrib/localflavor/us/forms.py

    diff -r f29e41c02921 django/contrib/localflavor/us/forms.py
    a b  
    1313from django.utils.translation import ugettext_lazy as _
    1414
    1515
    16 phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
     16phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-/\.]?(\d{3})[-\.]?(\d{4})$')
    1717ssn_re = re.compile(r"^(?P<area>\d{3})[-\ ]?(?P<group>\d{2})[-\ ]?(?P<serial>\d{4})$")
    1818
    1919class USZipCodeField(RegexField):
     
    3434        super(USPhoneNumberField, self).clean(value)
    3535        if value in EMPTY_VALUES:
    3636            return u''
    37         value = re.sub('(\(|\)|\s+)', '', smart_unicode(value))
     37        value = re.sub('(\(|\)|/|\s+)', '', smart_unicode(value))
    3838        m = phone_digits_re.search(value)
    3939        if m:
    4040            return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
  • tests/regressiontests/localflavor/us/tests.py

    diff -r f29e41c02921 tests/regressiontests/localflavor/us/tests.py
    a b  
    253253            '312.555.1212': '312-555-1212',
    254254            '312.555-1212': '312-555-1212',
    255255            ' (312) 555.1212 ': '312-555-1212',
     256            '312/555.1212 ': '312-555-1212',
     257            '312/555 1212 ': '312-555-1212',
     258            '312/555-1212 ': '312-555-1212',
    256259        }
    257260        invalid = {
    258261            '555-1212': error_format,
    259262            '312-55-1212': error_format,
     263            '312-555/1212': error_format,
     264            '312/555/1212': error_format,
    260265        }
    261266        self.assertFieldOutput(USPhoneNumberField, valid, invalid)
    262267
Back to Top