Repository: joke2k/faker

Issue:
Fake ISBN10 causes "Registrant/Publication not found"
In rare cases the `fake.isbn10` method throws an exception with the following message: `Exception: Registrant/Publication not found in registrant rule list. `

A full exception message:
```
/usr/local/lib/python3.6/site-packages/faker/providers/isbn/__init__.py:70: in isbn10
    ean, group, registrant, publication = self._body()
/usr/local/lib/python3.6/site-packages/faker/providers/isbn/__init__.py:41: in _body
    registrant, publication = self._registrant_publication(reg_pub, rules)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
reg_pub = '64799998'
rules = [RegistrantRule(min='0000000', max='1999999', registrant_length=2), RegistrantRule(min='2000000', max='2279999', regis...'6480000', max='6489999', registrant_length=7), RegistrantRule(min='6490000', max='6999999', registrant_length=3), ...]

    @staticmethod
    def _registrant_publication(reg_pub, rules):
        """ Separate the registration from the publication in a given
            string.
            :param reg_pub: A string of digits representing a registration
                and publication.
            :param rules: A list of RegistrantRules which designate where
                to separate the values in the string.
            :returns: A (registrant, publication) tuple of strings.
            """
        for rule in rules:
            if rule.min <= reg_pub <= rule.max:
                reg_len = rule.registrant_length
                break
        else:
>           raise Exception('Registrant/Publication not found in registrant '
                            'rule list.')
E           Exception: Registrant/Publication not found in registrant rule list.

/usr/local/lib/python3.6/site-packages/faker/providers/isbn/__init__.py:59: Exception
```
### Steps to reproduce

Call `faker.providers.isbn.Provider._registrant_publication` with any of the following values for the `reg_pub` param: `64799998`, `39999999`. These values are valid randomly generated strings from [L34](https://github.com/joke2k/faker/blob/master/faker/providers/isbn/__init__.py#L37).

Code:
```python
from faker.providers.isbn import Provider
from faker.providers.isbn.rules import RULES

# Fails; throws an exception
Provider._registrant_publication('64799998', RULES['978']['0'])
Provider._registrant_publication('39999999', RULES['978']['1'])

# Works; but may be invalid
Provider._registrant_publication('64799998', RULES['978']['1'])
Provider._registrant_publication('39999999', RULES['978']['0'])
```

### Expected behavior

The `faker.providers.isbn.Provider._body` should generate valid `reg_pub` values.

### Actual behavior

It generates values for `reg_pub` that are not accepted by the rules defined in `faker.providers.isbn.rules`.


Discussion:
fcurella: Thank you so much ✨ 

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:


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):