Add Django-1.2.1
[frozenviper.git] / Django-1.2.1 / tests / regressiontests / forms / localflavor / cl.py
blob23e7a4190225efb751f0d7384806cd634d6f260b
2 # Tests for the contrib/localflavor/ CL form fields.
4 tests = r"""
5 ## CLRutField #############################################################
7 CLRutField is a Field that checks the validity of the Chilean
8 personal identification number (RUT). It has two modes relaxed (default) and
9 strict.
11 >>> from django.contrib.localflavor.cl.forms import CLRutField
12 >>> rut = CLRutField()
14 >>> rut.clean('11-6')
15 u'11-6'
16 >>> rut.clean('116')
17 u'11-6'
19 # valid format, bad verifier.
20 >>> rut.clean('11.111.111-0')
21 Traceback (most recent call last):
22 ...
23 ValidationError: [u'The Chilean RUT is not valid.']
24 >>> rut.clean('111')
25 Traceback (most recent call last):
26 ...
27 ValidationError: [u'The Chilean RUT is not valid.']
29 >>> rut.clean('767484100')
30 u'76.748.410-0'
31 >>> rut.clean('78.412.790-7')
32 u'78.412.790-7'
33 >>> rut.clean('8.334.6043')
34 u'8.334.604-3'
35 >>> rut.clean('76793310-K')
36 u'76.793.310-K'
38 Strict RUT usage (does not allow imposible values)
39 >>> rut = CLRutField(strict=True)
41 >>> rut.clean('11-6')
42 Traceback (most recent call last):
43 ...
44 ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.']
46 # valid format, bad verifier.
47 >>> rut.clean('11.111.111-0')
48 Traceback (most recent call last):
49 ...
50 ValidationError: [u'The Chilean RUT is not valid.']
52 # Correct input, invalid format.
53 >>> rut.clean('767484100')
54 Traceback (most recent call last):
55 ...
56 ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.']
57 >>> rut.clean('78.412.790-7')
58 u'78.412.790-7'
59 >>> rut.clean('8.334.6043')
60 Traceback (most recent call last):
61 ...
62 ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.']
63 >>> rut.clean('76793310-K')
64 Traceback (most recent call last):
65 ...
66 ValidationError: [u'Enter a valid Chilean RUT. The format is XX.XXX.XXX-X.']
68 ## CLRegionSelect #########################################################
69 >>> from django.contrib.localflavor.cl.forms import CLRegionSelect
70 >>> f = CLRegionSelect()
72 >>> f.render('foo', 'bar')
73 u'<select name="foo">\n<option value="RM">Regi\xf3n Metropolitana de Santiago</option>\n<option value="I">Regi\xf3n de Tarapac\xe1</option>\n<option value="II">Regi\xf3n de Antofagasta</option>\n<option value="III">Regi\xf3n de Atacama</option>\n<option value="IV">Regi\xf3n de Coquimbo</option>\n<option value="V">Regi\xf3n de Valpara\xedso</option>\n<option value="VI">Regi\xf3n del Libertador Bernardo O&#39;Higgins</option>\n<option value="VII">Regi\xf3n del Maule</option>\n<option value="VIII">Regi\xf3n del B\xedo B\xedo</option>\n<option value="IX">Regi\xf3n de la Araucan\xeda</option>\n<option value="X">Regi\xf3n de los Lagos</option>\n<option value="XI">Regi\xf3n de Ays\xe9n del General Carlos Ib\xe1\xf1ez del Campo</option>\n<option value="XII">Regi\xf3n de Magallanes y la Ant\xe1rtica Chilena</option>\n<option value="XIV">Regi\xf3n de Los R\xedos</option>\n<option value="XV">Regi\xf3n de Arica-Parinacota</option>\n</select>'
74 """