diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2018-04-10 23:09:10 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2018-04-10 23:19:53 +0200 |
commit | e6739be9b4cebf01e331c6aaf075f49843883478 (patch) | |
tree | c3fd7b0c1f82f501797bd66d75f7d5b466f24774 /stdnum/imsi.py | |
parent | 2541a22eb29c5abd7cbf276ff4a35c56fbebb8d5 (diff) |
Correctly split IMSI with multi-length MNC
Ensures that imsi.split() will correctly split the IMSI into an MCC, MNC
and MSIN even if not all MNCs within a single MCC have the same length.
This has the downside of not being able to guess the MNC length in some
cases.
This also omits empty information from the data file and updates the
data file from Wikipedia.
Closes https://github.com/arthurdejong/python-stdnum/issues/68
Diffstat (limited to 'stdnum/imsi.py')
-rw-r--r-- | stdnum/imsi.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stdnum/imsi.py b/stdnum/imsi.py index 666f5e4..b887284 100644 --- a/stdnum/imsi.py +++ b/stdnum/imsi.py @@ -66,8 +66,8 @@ def validate(number): raise InvalidFormat() if len(number) not in (14, 15): raise InvalidLength() - if len(split(number)) != 3: - raise InvalidComponent() + if len(split(number)) < 2: + raise InvalidComponent() # unknown MCC return number |