Commit 325114fa authored by Aurel's avatar Aurel

add a regex and test for a new telephone input case


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25330 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c09f952f
......@@ -72,11 +72,11 @@ class Telephone(Coordinate, Base):
# be carefull to add a new regex.
regex_list = [
# Country, Area, City, Number, Extension*
"\+(?P<country>[\d ]+)(?P<toto>\(0\)|\ |\-)(?P<area>\d+)(\-|\ )(?P<city>\d+)(\-|\ )(?P<number>[\d\ \-]*)(?:\/)?(?P<ext>\d+|)",
"\+(?P<country>[\d ]+)(\(0\)|\ |\-)(?P<area>\d+)(\-|\ )(?P<city>\d+)(\-|\ )(?P<number>[\d\ \-]*)(?:\/)?(?P<ext>\d+|)",
# Area, City, Number, Extension*
"^(\(0\)|0)?(?P<area>\d+)(\-|\ |\/)(?P<city>\d+)(\-|\ )(?P<number>[\d\ \-]*)(?:\/)?(?P<ext>\d+|)",
"^\+(\(0\)|0)+(?P<area>\d+)(\-|\ |\/)(?P<city>\d+)(\-|\ )(?P<number>[\d\ \-]*)(?:\/)?(?P<ext>\d+|)",
# Country, Area, Number, Extension*
# +11(0)1-11111111/111 or +11(0)1-11111111/ or +11(0)1-11111111
# +11(0)1-1111-1111/111 or +11(0)1-1111-1111/ or +11(0)1-1111-1111
......
......@@ -933,6 +933,9 @@ class TestERP5Base(ERP5TypeTestCase):
['+111 11111111/111', '+111(0)-11111111/111'],
['+111 11111111/', '+111(0)-11111111'],
['+111 11111111', '+111(0)-11111111'],
['+(0)1-1111-1111/111', '+(0)1-1111-1111/111'],
['+(0)1-1111-1111/', '+(0)1-1111-1111'],
['+(0)1-1111-1111', '+(0)1-1111-1111'],
['+(0)1-11111111/111', '+(0)1-11111111/111'],
['+(0)1-11111111/', '+(0)1-11111111'],
['+(0)1-11111111', '+(0)1-11111111'],
......@@ -1081,7 +1084,6 @@ class TestERP5Base(ERP5TypeTestCase):
for i in input_list:
tel.fromText(coordinate_text=i[0])
print i
self.assertEquals(i[1],tel.asText())
def test_TelephoneWhenTheDefaultCountryAndAreaPreferenceIsBlank(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment