# Tests for the contrib/localflavor/ CL form fields. tests = r""" ## CLRutField ############################################################# CLRutField is a Field that checks the validity of the Chilean personal identification number (RUT). It has two modes relaxed (default) and strict. >>> from django.contrib.localflavor.cl.forms import CLRutField >>> rut = CLRutField() >>> rut.clean('11-6') u'11-6' >>> rut.clean('116') u'11-6' # valid format, bad verifier. >>> rut.clean('11.111.111-0') Traceback (most recent call last): ... ValidationError: [u'The Chilean RUT is not valid.'] >>> rut.clean('111') Traceback (most recent call last): ... ValidationError: [u'The Chilean RUT is not valid.'] >>> rut.clean('767484100') u'76.748.410-0' >>> rut.clean('78.412.790-7') u'78.412.790-7' >>> rut.clean('8.334.6043') u'8.334.604-3' >>> rut.clean('76793310-K') u'76.793.310-K' Strict RUT usage (does not allow imposible values) >>> rut = CLRutField(strict=True) >>> rut.clean('11-6') Traceback (most recent call last): ... ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'] # valid format, bad verifier. >>> rut.clean('11.111.111-0') Traceback (most recent call last): ... ValidationError: [u'The Chilean RUT is not valid.'] # Correct input, invalid format. >>> rut.clean('767484100') Traceback (most recent call last): ... ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'] >>> rut.clean('78.412.790-7') u'78.412.790-7' >>> rut.clean('8.334.6043') Traceback (most recent call last): ... ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'] >>> rut.clean('76793310-K') Traceback (most recent call last): ... ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.'] ## CLRegionSelect ######################################################### >>> from django.contrib.localflavor.cl.forms import CLRegionSelect >>> f = CLRegionSelect() >>> f.render('foo', 'bar') u'' """