Repository: identique/idnumbers (language: python)

Issue:
id number for Nepal
https://en.wikipedia.org/wiki/National_identification_number#Nepal


Discussion / hints:

Fix patch:
diff --git a/idnumbers/nationalid/NPL.py b/idnumbers/nationalid/NPL.py
new file mode 100644
index 00000000..58f1371f
--- /dev/null
+++ b/idnumbers/nationalid/NPL.py
@@ -0,0 +1,37 @@
+import re
+from types import SimpleNamespace
+
+from .util import validate_regexp
+
+
+class NationalID:
+    """
+    Nepal national identity card number, NIN
+    https://en.wikipedia.org/wiki/National_identification_number#Nepal
+    https://nimc.gov.ng/about-nin/
+    """
+    METADATA = SimpleNamespace(**{
+        'iso3166_alpha2': 'NP',
+        'min_length': 11,
+        'max_length': 11,
+        # length without insignificant chars
+        'parsable': False,
+        # has parse function
+        'checksum': False,
+        # has checksum function
+        'regexp': re.compile(r'^\d{11}$')
+        # regular expression to validate the id
+    })
+
+    @staticmethod
+    def validate(id_number: str) -> bool:
+        """
+        Validate
+        """
+        return validate_regexp(id_number, NationalID.METADATA.regexp)
+
+
+NIN = NationalID
+"""
+alias of https://nimc.gov.ng/about-nin/
+"""


Test patch:
diff --git a/tests/nationalid/test_NPL.py b/tests/nationalid/test_NPL.py
new file mode 100644
index 00000000..4aa647aa
--- /dev/null
+++ b/tests/nationalid/test_NPL.py
@@ -0,0 +1,11 @@
+from unittest import TestCase
+
+from idnumbers.nationalid import NPL
+
+
+class TestNPLValidation(TestCase):
+    def test_normal_case(self):
+        self.assertTrue(NPL.NationalID.validate('12345678901'))
+
+    def test_error_case(self):
+        self.assertFalse(NPL.NationalID.validate('1234567890'))