From e6739be9b4cebf01e331c6aaf075f49843883478 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Tue, 10 Apr 2018 23:09:10 +0200 Subject: 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 --- stdnum/imsi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'stdnum/imsi.py') 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 -- cgit v1.2.3