Repository: joke2k/faker
Pull request #1044 (2019-11-09 10:22:05)

add more phone numbers
### What does this changes

Add more phone number prefixes.

### What was wrong

Id dose not cover all of iranian mobile numbers

### How this fixes it

add new operator and 8 new prefixes 

Fixes #...



Patch:
diff --git a/faker/providers/isbn/__init__.py b/faker/providers/isbn/__init__.py
index ada84898..2d6ace9c 100644
--- a/faker/providers/isbn/__init__.py
+++ b/faker/providers/isbn/__init__.py
@@ -52,7 +52,7 @@ class Provider(BaseProvider):
         :returns: A (registrant, publication) tuple of strings.
         """
         for rule in rules:
-            if rule.min <= reg_pub <= rule.max:
+            if rule.min <= reg_pub[:-1] <= rule.max:
                 reg_len = rule.registrant_length
                 break
         else:
diff --git a/faker/providers/phone_number/fa_IR/__init__.py b/faker/providers/phone_number/fa_IR/__init__.py
index 07f60d0b..ed6a1acb 100644
--- a/faker/providers/phone_number/fa_IR/__init__.py
+++ b/faker/providers/phone_number/fa_IR/__init__.py
@@ -5,14 +5,34 @@ from .. import Provider as PhoneNumberProvider
 class Provider(PhoneNumberProvider):
     formats = (
         # Mobile
+        # Mci
         '+98 91# ### ####',
         '091# ### ####',
+        '+98 990 ### ####',
+        '0990 ### ####',
+        '+98 991 ### ####',
+        '0991 ### ####',
+        # Rightel Mobile prefixes
         '+98 920 ### ####',
         '0920 ### ####',
         '+98 921 ### ####',
         '0921 ### ####',
+        '+98 922 ### ####',
+        '0922 ### ####',
+        # Samantel Mobile prefixes
+        '+98 999 ### ####',
+        '0999 ### ####',
+        # Mtn and Talia
         '+98 93# ### ####',
         '093# ### ####',
+        '+98 901 ### ####',
+        '0901 ### ####',
+        '+98 902 ### ####',
+        '902 ### ####',
+        '+98 903 ### ####',
+        '0903 ### ####',
+        '+98 905 ### ####',
+        '0905 ### ####',
         # Land lines,
         # https://en.wikipedia.org/wiki/List_of_dialling_codes_in_Iran
         '+98 21 #### ####',


Test patch:
diff --git a/tests/providers/test_isbn.py b/tests/providers/test_isbn.py
index 4d6fab06..fe01c4aa 100644
--- a/tests/providers/test_isbn.py
+++ b/tests/providers/test_isbn.py
@@ -43,8 +43,13 @@ class TestProvider(unittest.TestCase):
     def test_reg_pub_separation(self):
         r1 = RegistrantRule('0000000', '0000001', 1)
         r2 = RegistrantRule('0000002', '0000003', 2)
-        assert self.prov._registrant_publication('0000000', [r1, r2]) == ('0', '000000')
-        assert self.prov._registrant_publication('0000002', [r1, r2]) == ('00', '00002')
+        assert self.prov._registrant_publication('00000000', [r1, r2]) == ('0', '0000000')
+        assert self.prov._registrant_publication('00000010', [r1, r2]) == ('0', '0000010')
+        assert self.prov._registrant_publication('00000019', [r1, r2]) == ('0', '0000019')
+        assert self.prov._registrant_publication('00000020', [r1, r2]) == ('00', '000020')
+        assert self.prov._registrant_publication('00000030', [r1, r2]) == ('00', '000030')
+        assert self.prov._registrant_publication('00000031', [r1, r2]) == ('00', '000031')
+        assert self.prov._registrant_publication('00000039', [r1, r2]) == ('00', '000039')
 
     def test_rule_not_found(self):
         with pytest.raises(Exception):