Ticket #11350: il.py

File il.py, 1.4 KB (added by Yuval Adam, 15 years ago)

Added regression tests

Line 
1# -*- coding: utf-8 -*-
2# Tests for the contrib/localflavor/ IL Form Fields
3
4tests = r"""
5# CZPostalCodeField #########################################################
6
7>>> from django.contrib.localflavor.il.forms import ILPostalCodeField
8>>> f = ILPostalCodeField()
9>>> f.clean('84545x')
10Traceback (most recent call last):
11...
12ValidationError: [u'Enter a postal code in the format XXXXX']
13>>> f.clean('69973')
14u'69973'
15>>> f.clean('699 73')
16u'69973'
17>>> f.clean('12345')
18u'12345'
19>>> f.clean('123456')
20Traceback (most recent call last):
21...
22ValidationError: [u'Enter a postal code in the format XXXXX']
23>>> f.clean('1234')
24Traceback (most recent call last):
25...
26ValidationError: [u'Enter a postal code in the format XXXXX']
27>>> f.clean('123 4')
28Traceback (most recent call last):
29...
30ValidationError: [u'Enter a postal code in the format XXXXX']
31
32# ILIDNumberField ########################################################
33
34>>> from django.contrib.localflavor.il.forms import ILIDNumberField
35>>> f = ILIDNumberField()
36>>> f.clean('39337423')
37u'39337423'
38>>> f.clean('039337423')
39u'039337423'
40>>> f.clean('0091')
41u'0091'
42>>> f.clean('123465789')
43Traceback (most recent call last):
44...
45ValidationError: [u'Enter a valid ID number.']
46>>> f.clean('012346578')
47Traceback (most recent call last):
48...
49ValidationError: [u'Enter a valid ID number.']
50>>> f.clean('0001')
51Traceback (most recent call last):
52...
53ValidationError: [u'Enter a valid ID number.']
54"""
Back to Top