Skip to content

Commit

Permalink
Updating patterns to libphonenumber v8.12.7 (#8)
Browse files Browse the repository at this point in the history
* Updating patterns to libphonenumber v8.12.7
  • Loading branch information
tolstislon committed Jul 24, 2020
1 parent 1f81049 commit 04da4d9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ install:
- pip install -e .
script:
- pip freeze | grep phonenumbers
- pytest tests
- pytest tests -m "not phonenumbers"


deploy:
provider: pypi
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ flake8 = "==3.8.3"
pep8-naming = "==0.11.1"

[packages]
phone-gen = {editable = true,path = "."}
phone-gen = {editable = true, path = "."}

[requires]
python_version = "3.8"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Need Python 3.6 or more.

Changelog
----
* **1.3.4** Updating patterns to libphonenumber v8.12.7
* **1.3.3** Updating patterns to libphonenumber v8.12.6
* **1.3.2** Fix `MI` invalid pattern
* **1.3.1** Updating patterns to libphonenumber v8.12.5
Expand Down
20 changes: 10 additions & 10 deletions phone_gen/patterns.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
"""
Auto-generated file 2020-06-19 13:21:13 UTC
Resource: https://github.com/google/libphonenumber v8.12.6
Auto-generated file 2020-07-21 16:06:02 UTC
Resource: https://github.com/google/libphonenumber v8.12.7
"""


PATTERNS = {
"info": "libphonenumber v8.12.6",
"info": "libphonenumber v8.12.7",
"data": {
"AC": {"code": "247", "pattern": "((6[2-467][\\d]{3}))"},
"AD": {"code": "376", "pattern": "(([78][\\d]{5}))"},
Expand Down Expand Up @@ -218,7 +218,7 @@
},
"ET": {
"code": "251",
"pattern": "((116671[\\d]{3})|((11(1(1[124])|(2[2-7])|(3[1-5])|(5[5-8])|(8[6-8]))|(2(13)|(3[6-8])|(5[89])|(7[05-9])|(8[2-6]))|(3(2[01])|(3[0-289])|(4[1289])|(7[1-4])|(87))|(4(1[69])|(3[2-49])|(4[0-3])|(6[5-8]))|(5(1[578])|(44)|(5[0-4]))|(6(1[78])|(2[69])|(39)|(4[5-7])|(5[1-5])|(6[0-59])|(8[015-8])))|(2(2(11[1-9])|(22[0-7])|(33[\\d])|(44[1467])|(66[1-68]))|(5(11[124-6])|(33[2-8])|(44[1467])|(55[14])|(66[1-3679])|(77[124-79])|(880)))|(3(3(11[0-46-8])|((22)|(55)[0-6])|(33[0134689])|(44[04])|(66[01467]))|(4(44[0-8])|(55[0-69])|(66[0-3])|(77[1-5])))|(4(6(119)|(22[0-24-7])|(33[1-5])|(44[13-69])|(55[14-689])|(660)|(88[1-4]))|(7((11)|(22)[1-9])|(33[13-7])|(44[13-6])|(55[1-689])))|(5(7(227)|(55[05])|((66)|(77)[14-8]))|(8(11[149])|(22[013-79])|(33[0-68])|(44[013-8])|(550)|(66[1-5])|(77[\\d])))[\\d]{4}))",
"pattern": "((11667[01][\\d]{3})|((11(1(1[124])|(2[2-7])|(3[1-5])|(5[5-8])|(8[6-8]))|(2(13)|(3[6-8])|(5[89])|(7[05-9])|(8[2-6]))|(3(2[01])|(3[0-289])|(4[1289])|(7[1-4])|(87))|(4(1[69])|(3[2-49])|(4[0-3])|(6[5-8]))|(5(1[578])|(44)|(5[0-4]))|(6(1[78])|(2[69])|(39)|(4[5-7])|(5[1-5])|(6[0-59])|(8[015-8])))|(2(2(11[1-9])|(22[0-7])|(33[\\d])|(44[1467])|(66[1-68]))|(5(11[124-6])|(33[2-8])|(44[1467])|(55[14])|(66[1-3679])|(77[124-79])|(880)))|(3(3(11[0-46-8])|((22)|(55)[0-6])|(33[0134689])|(44[04])|(66[01467]))|(4(44[0-8])|(55[0-69])|(66[0-3])|(77[1-5])))|(4(6(119)|(22[0-24-7])|(33[1-5])|(44[13-69])|(55[14-689])|(660)|(88[1-4]))|(7((11)|(22)[1-9])|(33[13-7])|(44[13-6])|(55[1-689])))|(5(7(227)|(55[05])|((66)|(77)[14-8]))|(8(11[149])|(22[013-79])|(33[0-68])|(44[013-8])|(550)|(66[1-5])|(77[\\d])))[\\d]{4}))",
},
"FI": {
"code": "358",
Expand Down Expand Up @@ -301,7 +301,7 @@
},
"HN": {
"code": "504",
"pattern": "((2(2(0[0139])|(1[1-36])|([23][\\d])|(4[04-6])|(5[57])|(6[24])|(7[0135689])|(8[01346-9])|(9[0-2]))|(4(07)|(2[3-59])|(3[13-689])|(4[0-68])|(5[1-35]))|(5(0[7-9])|(16)|(4[03-5])|(5[\\d])|(6[014-6])|(74)|(80))|(6([056][\\d])|(17)|(2[07])|(3[04])|(4[0-378])|([78][0-8])|(9[01]))|(7(6[46-9])|(7[02-9])|(8[034])|(91))|(8(79)|(8[0-357-9])|(9[1-57-9]))[\\d]{4}))",
"pattern": "((2(2(0[0139])|(1[1-36])|([23][\\d])|(4[04-6])|(5[57])|(6[245])|(7[0135689])|(8[01346-9])|(9[0-2]))|(4(0[78])|(2[3-59])|(3[13-689])|(4[0-68])|(5[1-35]))|(5(0[7-9])|(16)|(4[03-5])|(5[\\d])|(6[014-6])|(74)|(80))|(6([056][\\d])|(17)|(2[07])|(3[04])|(4[0-378])|([78][0-8])|(9[01]))|(7(6[46-9])|(7[02-9])|(8[034])|(91))|(8(79)|(8[0-357-9])|(9[1-57-9]))[\\d]{4}))",
},
"HR": {
"code": "385",
Expand Down Expand Up @@ -381,7 +381,7 @@
"KM": {"code": "269", "pattern": "((7[4-7][\\d]{5}))"},
"KN": {
"code": "1",
"pattern": "((869(2(29)|(36))|(302)|(4(6[015-9])|(70))[\\d]{4}))",
"pattern": "((869(2(29)|(36))|(302)|(4(6[015-9])|(70))|(56[5-7])[\\d]{4}))",
},
"KP": {
"code": "850",
Expand Down Expand Up @@ -417,7 +417,7 @@
},
"LI": {
"code": "423",
"pattern": "(((2(01)|(1[27])|(22)|(3[\\d])|(6[02-578])|(96))|(3(33)|(40)|(7[0135-7])|(8[048])|(9[0269]))[\\d]{4}))",
"pattern": "(((2(01)|(1[27])|(2[02])|(3[\\d])|(6[02-578])|(96))|(3([24]0)|(33)|(7[0135-7])|(8[048])|(9[0269]))[\\d]{4}))",
},
"LK": {
"code": "94",
Expand Down Expand Up @@ -493,7 +493,7 @@
},
"MU": {
"code": "230",
"pattern": "(((2([0346-8][\\d])|(1[0-7]))|(4([013568][\\d])|(2[4-7]))|(54([34][\\d])|(71))|(6[\\d][\\d])|(8(14)|(3[129]))[\\d]{4}))",
"pattern": "(((2([0346-8][\\d])|(1[0-7]))|(4([013568][\\d])|(2[4-7]))|(54([3-5][\\d])|(71))|(6[\\d][\\d])|(8(14)|(3[129]))[\\d]{4}))",
},
"MV": {
"code": "960",
Expand All @@ -514,7 +514,7 @@
},
"NA": {
"code": "264",
"pattern": "((6(1([02-4][\\d][\\d])|(17))|(2(17)|(54[\\d])|(69)|(70))|(3(17)|(2[0237][\\d])|(34)|(6[289])|(7[01])|(81))|(4(17)|((27)|(41)|(5[25])[\\d])|(69)|(7[01]))|(5(17)|(2[236-8][\\d])|(69)|(7[01]))|(6(17)|(26[\\d])|(38)|(42)|(69)|(7[01]))|(7(17)|((2[2-4])|(30)[\\d])|(6[89])|(7[01]))[\\d]{4})|(6(1(2[2-7])|(3[01378])|(4[0-4])|(69)|(7[014]))|(25[0-46-8])|(32[\\d])|(4(2[0-27])|(4[016])|(5[0-357]))|(52[02-9])|(62[56])|(7(2[2-69])|(3[013]))[\\d]{4}))",
"pattern": "((64426[\\d]{3})|(6(1(2[2-7])|(3[01378])|(4[0-4]))|(254)|(32[0237])|(4(27)|(41)|(5[25]))|(52[236-8])|(626)|(7(2[2-4])|(30))[\\d]{4:5})|(6(1((0[\\d])|(2[0189])|(3[24-69])|(4[5-9])[\\d])|(17)|(69)|(7[014]))|(2(17)|(5[0-36-8])|(69)|(70))|(3(17)|(2[14-689])|(34)|(6[289])|(7[01])|(81))|(4(17)|(2[0-2])|(4[06])|(5[0137])|(69)|(7[01]))|(5(17)|(2[0459])|(69)|(7[01]))|(6(17)|(25)|(38)|(42)|(69)|(7[01]))|(7(17)|(2[569])|(3[13])|(6[89])|(7[01]))[\\d]{4}))",
},
"NC": {
"code": "687",
Expand Down Expand Up @@ -714,7 +714,7 @@
},
"US": {
"code": "1",
"pattern": "(((2(0[1-35-9])|(1[02-9])|(2[03-589])|(3[149])|(4[08])|(5[1-46])|(6[0279])|(7[0269])|(8[13]))|(3(0[1-57-9])|(1[02-9])|(2[0135])|(3[0-24679])|(4[167])|(5[12])|(6[014])|(8[056]))|(4(0[124-9])|(1[02-579])|(2[3-5])|(3[0245])|(4[0235])|(58)|(6[39])|(7[0589])|(8[04]))|(5(0[1-57-9])|(1[0235-8])|(20)|(3[0149])|(4[01])|(5[19])|(6[1-47])|(7[013-5])|(8[056]))|(6(0[1-35-9])|(1[024-9])|(2[03689])|([34][016])|(5[0179])|(6[0-279])|(78)|(8[0-29]))|(7(0[1-46-8])|(1[2-9])|(2[04-7])|(3[1247])|(4[037])|(5[47])|(6[02359])|(7[02-59])|(8[156]))|(8(0[1-68])|(1[02-8])|(2[08])|(3[0-28])|(4[3578])|(5[046-9])|(6[02-5])|(7[028]))|(9(0[1346-9])|(1[02-9])|(2[0589])|(3[0146-8])|(4[0179])|(5[12469])|(7[0-389])|(8[04-69]))[2-9][\\d]{6}))",
"pattern": "(((2(0[1-35-9])|(1[02-9])|(2[03-589])|(3[149])|(4[08])|(5[1-46])|(6[0279])|(7[0269])|(8[13]))|(3(0[1-57-9])|(1[02-9])|(2[01356])|(3[0-24679])|(4[167])|(5[12])|(6[014])|(8[056]))|(4(0[124-9])|(1[02-579])|(2[3-5])|(3[0245])|(4[0235])|(58)|(6[39])|(7[0589])|(8[04]))|(5(0[1-57-9])|(1[0235-8])|(20)|(3[0149])|(4[01])|(5[19])|(6[1-47])|(7[013-5])|(8[056]))|(6(0[1-35-9])|(1[024-9])|(2[03689])|([34][016])|(5[0179])|(6[0-279])|(78)|(8[0-29]))|(7(0[1-46-8])|(1[2-9])|(2[04-7])|(3[1247])|(4[037])|(5[47])|(6[02359])|(7[02-59])|(8[156]))|(8(0[1-68])|(1[02-8])|(2[08])|(3[0-289])|(4[3578])|(5[046-9])|(6[02-5])|(7[028]))|(9(0[1346-9])|(1[02-9])|(2[0589])|(3[0146-8])|(4[0179])|(5[12469])|(7[0-389])|(8[04-69]))[2-9][\\d]{6}))",
},
"UY": {"code": "598", "pattern": "(((2[\\d])|(4[2-7])[\\d]{6}))"},
"UZ": {
Expand Down
5 changes: 4 additions & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
addopts =
--cov-report=xml
--cov=phone_gen tests/
-l
-l

markers =
phonenumbers: Dependency on phonenumbers
2 changes: 2 additions & 0 deletions tests/test_alt_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from phone_gen import PhoneNumber


@pytest.mark.phonenumbers
@pytest.mark.parametrize('count', range(5))
@pytest.mark.parametrize('code, ref', [
(key, value['ref']) for key, value in ALT_PATTERNS.items() if 'pattern' in value and 'ref' in value
Expand All @@ -15,6 +16,7 @@ def test_alt_pattern(code, ref, count):
assert phonenumbers.is_valid_number_for_region(num_obj, ref)


@pytest.mark.phonenumbers
@pytest.mark.parametrize('count', range(5))
@pytest.mark.parametrize('code, ref', [
(key, value['ref']) for key, value in ALT_PATTERNS.items() if 'pattern' not in value and 'ref' in value
Expand Down
4 changes: 4 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from phone_gen.patterns import PATTERNS


@pytest.mark.phonenumbers
@pytest.mark.parametrize('country', random.sample(tuple(PATTERNS['data'].keys()), 20))
def test_get_country(capfd, country):
os.system('phone-gen {}'.format(country))
Expand All @@ -15,6 +16,7 @@ def test_get_country(capfd, country):
assert phonenumbers.is_valid_number_for_region(num_obg, country)


@pytest.mark.phonenumbers
@pytest.mark.parametrize('country', random.sample(tuple(PATTERNS['data'].keys()), 20))
def test_get_without_country_code(capfd, country):
os.system('phone-gen {} -n'.format(country))
Expand All @@ -30,6 +32,7 @@ def test_invalid_country(capfd):
assert captured.out.strip() == 'Error: Not found country "qwe"'


@pytest.mark.phonenumbers
@pytest.mark.parametrize('country_name, code', (('Germany', 'DE'), ('Panama', 'PA'), ('Turkey', 'TR')))
def test_find_country_name(capfd, country_name, code):
os.system('phone-gen {}'.format(country_name))
Expand All @@ -38,6 +41,7 @@ def test_find_country_name(capfd, country_name, code):
assert phonenumbers.is_valid_number_for_region(num_obg, code)


@pytest.mark.phonenumbers
@pytest.mark.parametrize('iso, code', (('VNM', 'VN'), ('SLE', 'SL'), ('MCO', 'MC')))
def test_find_iso3(capfd, iso, code):
os.system('phone-gen {}'.format(iso))
Expand Down
1 change: 1 addition & 0 deletions tests/test_phone.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from phone_gen.patterns import PATTERNS


@pytest.mark.phonenumbers
@pytest.mark.parametrize('count', range(15))
@pytest.mark.parametrize('country', PATTERNS['data'].keys())
def test_patterns(country, count):
Expand Down

0 comments on commit 04da4d9

Please sign in to comment.