indiaval 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- indiaval-0.2.0/LICENSE +21 -0
- indiaval-0.2.0/PKG-INFO +79 -0
- indiaval-0.2.0/README.md +64 -0
- indiaval-0.2.0/pyproject.toml +23 -0
- indiaval-0.2.0/setup.cfg +4 -0
- indiaval-0.2.0/src/indiaval/__init__.py +11 -0
- indiaval-0.2.0/src/indiaval/validators.py +73 -0
- indiaval-0.2.0/src/indiaval.egg-info/PKG-INFO +79 -0
- indiaval-0.2.0/src/indiaval.egg-info/SOURCES.txt +10 -0
- indiaval-0.2.0/src/indiaval.egg-info/dependency_links.txt +1 -0
- indiaval-0.2.0/src/indiaval.egg-info/top_level.txt +1 -0
- indiaval-0.2.0/tests/test_validators.py +55 -0
indiaval-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 greeshmagowdaa4-lgtm
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
indiaval-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: indiaval
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Validators for Indian mobile, PIN code, PAN, IFSC, Aadhaar, GSTIN and vehicle numbers
|
|
5
|
+
Author: Greeshma Gowda K A
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/greeshmagowdaa4-lgtm/indiaval
|
|
8
|
+
Keywords: india,validation,aadhaar,pan,gstin,ifsc
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# indiaval
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
Simple Python validators for common Indian data formats: mobile numbers, PIN codes, PAN, IFSC codes, Aadhaar numbers, GSTIN and vehicle registration numbers.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install indiaval
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To work on the code locally:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/greeshmagowdaa4-lgtm/indiaval.git
|
|
32
|
+
cd indiaval
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from indiaval import (
|
|
40
|
+
is_valid_mobile,
|
|
41
|
+
is_valid_pincode,
|
|
42
|
+
is_valid_pan,
|
|
43
|
+
is_valid_ifsc,
|
|
44
|
+
is_valid_aadhaar,
|
|
45
|
+
is_valid_gstin,
|
|
46
|
+
is_valid_vehicle_number,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
is_valid_mobile("+91 9876543210") # True
|
|
50
|
+
is_valid_pincode("560001") # True
|
|
51
|
+
is_valid_pan("ABCDE1234F") # True
|
|
52
|
+
is_valid_ifsc("SBIN0001234") # True
|
|
53
|
+
is_valid_aadhaar("234567890124") # True
|
|
54
|
+
is_valid_gstin("27AAPFU0939F1ZV") # True
|
|
55
|
+
is_valid_vehicle_number("KA01AB1234") # True
|
|
56
|
+
|
|
57
|
+
is_valid_pincode("060001") # False (can't start with 0)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Validators
|
|
61
|
+
|
|
62
|
+
| Function | Checks |
|
|
63
|
+
|----------|--------|
|
|
64
|
+
| `is_valid_mobile` | 10-digit number starting with 6-9, optional `+91`, `91` or `0` prefix |
|
|
65
|
+
| `is_valid_pincode` | 6 digits, first digit not 0 |
|
|
66
|
+
| `is_valid_pan` | 5 letters, 4 digits, 1 letter |
|
|
67
|
+
| `is_valid_ifsc` | 4 letters, a zero, then 6 letters or digits |
|
|
68
|
+
| `is_valid_aadhaar` | 12 digits, first digit 2-9, valid Verhoeff checksum |
|
|
69
|
+
| `is_valid_gstin` | 15-character GSTIN with a valid state code and checksum |
|
|
70
|
+
| `is_valid_vehicle_number` | State code, 2 digits, 1-3 letters, 4 digits (e.g. `KA01AB1234`) |
|
|
71
|
+
|
|
72
|
+
These check the **format** only. They don't confirm that a number or code actually exists.
|
|
73
|
+
|
|
74
|
+
## Running tests
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install pytest
|
|
78
|
+
python -m pytest
|
|
79
|
+
```
|
indiaval-0.2.0/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# indiaval
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Simple Python validators for common Indian data formats: mobile numbers, PIN codes, PAN, IFSC codes, Aadhaar numbers, GSTIN and vehicle registration numbers.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install indiaval
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
To work on the code locally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/greeshmagowdaa4-lgtm/indiaval.git
|
|
17
|
+
cd indiaval
|
|
18
|
+
pip install -e .
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from indiaval import (
|
|
25
|
+
is_valid_mobile,
|
|
26
|
+
is_valid_pincode,
|
|
27
|
+
is_valid_pan,
|
|
28
|
+
is_valid_ifsc,
|
|
29
|
+
is_valid_aadhaar,
|
|
30
|
+
is_valid_gstin,
|
|
31
|
+
is_valid_vehicle_number,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
is_valid_mobile("+91 9876543210") # True
|
|
35
|
+
is_valid_pincode("560001") # True
|
|
36
|
+
is_valid_pan("ABCDE1234F") # True
|
|
37
|
+
is_valid_ifsc("SBIN0001234") # True
|
|
38
|
+
is_valid_aadhaar("234567890124") # True
|
|
39
|
+
is_valid_gstin("27AAPFU0939F1ZV") # True
|
|
40
|
+
is_valid_vehicle_number("KA01AB1234") # True
|
|
41
|
+
|
|
42
|
+
is_valid_pincode("060001") # False (can't start with 0)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Validators
|
|
46
|
+
|
|
47
|
+
| Function | Checks |
|
|
48
|
+
|----------|--------|
|
|
49
|
+
| `is_valid_mobile` | 10-digit number starting with 6-9, optional `+91`, `91` or `0` prefix |
|
|
50
|
+
| `is_valid_pincode` | 6 digits, first digit not 0 |
|
|
51
|
+
| `is_valid_pan` | 5 letters, 4 digits, 1 letter |
|
|
52
|
+
| `is_valid_ifsc` | 4 letters, a zero, then 6 letters or digits |
|
|
53
|
+
| `is_valid_aadhaar` | 12 digits, first digit 2-9, valid Verhoeff checksum |
|
|
54
|
+
| `is_valid_gstin` | 15-character GSTIN with a valid state code and checksum |
|
|
55
|
+
| `is_valid_vehicle_number` | State code, 2 digits, 1-3 letters, 4 digits (e.g. `KA01AB1234`) |
|
|
56
|
+
|
|
57
|
+
These check the **format** only. They don't confirm that a number or code actually exists.
|
|
58
|
+
|
|
59
|
+
## Running tests
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install pytest
|
|
63
|
+
python -m pytest
|
|
64
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "indiaval"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Validators for Indian mobile, PIN code, PAN, IFSC, Aadhaar, GSTIN and vehicle numbers"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Greeshma Gowda K A" }]
|
|
13
|
+
keywords = ["india", "validation", "aadhaar", "pan", "gstin", "ifsc"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/greeshmagowdaa4-lgtm/indiaval"
|
|
21
|
+
|
|
22
|
+
[tool.setuptools.packages.find]
|
|
23
|
+
where = ["src"]
|
indiaval-0.2.0/setup.cfg
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
_MOBILE = re.compile(r"(?:\+91[\-\s]?|91|0)?[6-9]\d{9}")
|
|
4
|
+
_PINCODE = re.compile(r"[1-9]\d{5}")
|
|
5
|
+
_PAN = re.compile(r"[A-Z]{5}\d{4}[A-Z]")
|
|
6
|
+
_IFSC = re.compile(r"[A-Z]{4}0[A-Z0-9]{6}")
|
|
7
|
+
_AADHAAR = re.compile(r"[2-9]\d{11}")
|
|
8
|
+
_GSTIN = re.compile(r"(0[1-9]|[1-2]\d|3[0-8])[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]")
|
|
9
|
+
_GSTIN_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
10
|
+
_VEHICLE = re.compile(r"[A-Z]{2}\d{2}[A-Z]{1,3}\d{4}")
|
|
11
|
+
|
|
12
|
+
_D = (
|
|
13
|
+
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (1, 2, 3, 4, 0, 6, 7, 8, 9, 5),
|
|
14
|
+
(2, 3, 4, 0, 1, 7, 8, 9, 5, 6), (3, 4, 0, 1, 2, 8, 9, 5, 6, 7),
|
|
15
|
+
(4, 0, 1, 2, 3, 9, 5, 6, 7, 8), (5, 9, 8, 7, 6, 0, 4, 3, 2, 1),
|
|
16
|
+
(6, 5, 9, 8, 7, 1, 0, 4, 3, 2), (7, 6, 5, 9, 8, 2, 1, 0, 4, 3),
|
|
17
|
+
(8, 7, 6, 5, 9, 3, 2, 1, 0, 4), (9, 8, 7, 6, 5, 4, 3, 2, 1, 0),
|
|
18
|
+
)
|
|
19
|
+
_P = (
|
|
20
|
+
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), (1, 5, 7, 6, 2, 8, 3, 0, 9, 4),
|
|
21
|
+
(5, 8, 0, 3, 7, 9, 6, 1, 4, 2), (8, 9, 1, 6, 0, 4, 3, 5, 2, 7),
|
|
22
|
+
(9, 4, 5, 3, 1, 2, 6, 8, 7, 0), (4, 2, 8, 6, 5, 7, 3, 9, 0, 1),
|
|
23
|
+
(2, 7, 9, 3, 8, 0, 6, 4, 1, 5), (7, 0, 4, 6, 9, 1, 3, 2, 5, 8),
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def is_valid_mobile(value: str) -> bool:
|
|
28
|
+
"""Indian mobile number, with optional +91, 91 or 0 prefix."""
|
|
29
|
+
return bool(_MOBILE.fullmatch(value.strip()))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def is_valid_pincode(value: str) -> bool:
|
|
33
|
+
"""6-digit PIN code that doesn't start with 0."""
|
|
34
|
+
return bool(_PINCODE.fullmatch(value.strip()))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def is_valid_pan(value: str) -> bool:
|
|
38
|
+
"""PAN format: 5 letters, 4 digits, 1 letter (e.g. ABCDE1234F)."""
|
|
39
|
+
return bool(_PAN.fullmatch(value.strip().upper()))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def is_valid_ifsc(value: str) -> bool:
|
|
43
|
+
"""IFSC format: 4 letters, a zero, 6 letters or digits (e.g. SBIN0001234)."""
|
|
44
|
+
return bool(_IFSC.fullmatch(value.strip().upper()))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def is_valid_aadhaar(value: str) -> bool:
|
|
48
|
+
"""12-digit Aadhaar number (spaces allowed) with a valid Verhoeff checksum."""
|
|
49
|
+
number = value.replace(" ", "")
|
|
50
|
+
if not _AADHAAR.fullmatch(number):
|
|
51
|
+
return False
|
|
52
|
+
c = 0
|
|
53
|
+
for i, ch in enumerate(reversed(number)):
|
|
54
|
+
c = _D[c][_P[i % 8][int(ch)]]
|
|
55
|
+
return c == 0
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def is_valid_gstin(value: str) -> bool:
|
|
59
|
+
"""15-character GSTIN with a valid checksum character."""
|
|
60
|
+
gstin = value.strip().upper()
|
|
61
|
+
if not _GSTIN.fullmatch(gstin):
|
|
62
|
+
return False
|
|
63
|
+
total = 0
|
|
64
|
+
for i, ch in enumerate(gstin[:14]):
|
|
65
|
+
v = _GSTIN_CHARS.index(ch) * (1 if i % 2 == 0 else 2)
|
|
66
|
+
total += v // 36 + v % 36
|
|
67
|
+
return _GSTIN_CHARS[(36 - total % 36) % 36] == gstin[14]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def is_valid_vehicle_number(value: str) -> bool:
|
|
71
|
+
"""Vehicle registration like KA01AB1234 (spaces and hyphens allowed)."""
|
|
72
|
+
number = value.upper().replace(" ", "").replace("-", "")
|
|
73
|
+
return bool(_VEHICLE.fullmatch(number))
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: indiaval
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Validators for Indian mobile, PIN code, PAN, IFSC, Aadhaar, GSTIN and vehicle numbers
|
|
5
|
+
Author: Greeshma Gowda K A
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/greeshmagowdaa4-lgtm/indiaval
|
|
8
|
+
Keywords: india,validation,aadhaar,pan,gstin,ifsc
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# indiaval
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
Simple Python validators for common Indian data formats: mobile numbers, PIN codes, PAN, IFSC codes, Aadhaar numbers, GSTIN and vehicle registration numbers.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install indiaval
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
To work on the code locally:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/greeshmagowdaa4-lgtm/indiaval.git
|
|
32
|
+
cd indiaval
|
|
33
|
+
pip install -e .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from indiaval import (
|
|
40
|
+
is_valid_mobile,
|
|
41
|
+
is_valid_pincode,
|
|
42
|
+
is_valid_pan,
|
|
43
|
+
is_valid_ifsc,
|
|
44
|
+
is_valid_aadhaar,
|
|
45
|
+
is_valid_gstin,
|
|
46
|
+
is_valid_vehicle_number,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
is_valid_mobile("+91 9876543210") # True
|
|
50
|
+
is_valid_pincode("560001") # True
|
|
51
|
+
is_valid_pan("ABCDE1234F") # True
|
|
52
|
+
is_valid_ifsc("SBIN0001234") # True
|
|
53
|
+
is_valid_aadhaar("234567890124") # True
|
|
54
|
+
is_valid_gstin("27AAPFU0939F1ZV") # True
|
|
55
|
+
is_valid_vehicle_number("KA01AB1234") # True
|
|
56
|
+
|
|
57
|
+
is_valid_pincode("060001") # False (can't start with 0)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Validators
|
|
61
|
+
|
|
62
|
+
| Function | Checks |
|
|
63
|
+
|----------|--------|
|
|
64
|
+
| `is_valid_mobile` | 10-digit number starting with 6-9, optional `+91`, `91` or `0` prefix |
|
|
65
|
+
| `is_valid_pincode` | 6 digits, first digit not 0 |
|
|
66
|
+
| `is_valid_pan` | 5 letters, 4 digits, 1 letter |
|
|
67
|
+
| `is_valid_ifsc` | 4 letters, a zero, then 6 letters or digits |
|
|
68
|
+
| `is_valid_aadhaar` | 12 digits, first digit 2-9, valid Verhoeff checksum |
|
|
69
|
+
| `is_valid_gstin` | 15-character GSTIN with a valid state code and checksum |
|
|
70
|
+
| `is_valid_vehicle_number` | State code, 2 digits, 1-3 letters, 4 digits (e.g. `KA01AB1234`) |
|
|
71
|
+
|
|
72
|
+
These check the **format** only. They don't confirm that a number or code actually exists.
|
|
73
|
+
|
|
74
|
+
## Running tests
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install pytest
|
|
78
|
+
python -m pytest
|
|
79
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/indiaval/__init__.py
|
|
5
|
+
src/indiaval/validators.py
|
|
6
|
+
src/indiaval.egg-info/PKG-INFO
|
|
7
|
+
src/indiaval.egg-info/SOURCES.txt
|
|
8
|
+
src/indiaval.egg-info/dependency_links.txt
|
|
9
|
+
src/indiaval.egg-info/top_level.txt
|
|
10
|
+
tests/test_validators.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
indiaval
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from indiaval import (
|
|
2
|
+
is_valid_mobile,
|
|
3
|
+
is_valid_pincode,
|
|
4
|
+
is_valid_pan,
|
|
5
|
+
is_valid_ifsc,
|
|
6
|
+
is_valid_aadhaar,
|
|
7
|
+
is_valid_gstin,
|
|
8
|
+
is_valid_vehicle_number,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_mobile():
|
|
13
|
+
assert is_valid_mobile("9876543210")
|
|
14
|
+
assert is_valid_mobile("+91 9876543210")
|
|
15
|
+
assert not is_valid_mobile("1234567890")
|
|
16
|
+
assert not is_valid_mobile("98765")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_pincode():
|
|
20
|
+
assert is_valid_pincode("560001")
|
|
21
|
+
assert not is_valid_pincode("060001")
|
|
22
|
+
assert not is_valid_pincode("56001")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_pan():
|
|
26
|
+
assert is_valid_pan("ABCDE1234F")
|
|
27
|
+
assert not is_valid_pan("ABCD12345F")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_ifsc():
|
|
31
|
+
assert is_valid_ifsc("SBIN0001234")
|
|
32
|
+
assert not is_valid_ifsc("SBIN1001234")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_aadhaar():
|
|
36
|
+
assert is_valid_aadhaar("234567890124")
|
|
37
|
+
assert is_valid_aadhaar("2345 6789 0124")
|
|
38
|
+
assert not is_valid_aadhaar("234567890125") # wrong checksum
|
|
39
|
+
assert not is_valid_aadhaar("123456789012") # starts with 1
|
|
40
|
+
assert not is_valid_aadhaar("23456789") # too short
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_gstin():
|
|
44
|
+
assert is_valid_gstin("27AAPFU0939F1ZV")
|
|
45
|
+
assert is_valid_gstin("29ABCDE1234F1ZW")
|
|
46
|
+
assert not is_valid_gstin("27AAPFU0939F1ZX") # wrong checksum
|
|
47
|
+
assert not is_valid_gstin("99AAPFU0939F1ZV") # invalid state code
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_vehicle_number():
|
|
51
|
+
assert is_valid_vehicle_number("KA01AB1234")
|
|
52
|
+
assert is_valid_vehicle_number("KA 01 AB 1234")
|
|
53
|
+
assert is_valid_vehicle_number("MH-12-DE-1433")
|
|
54
|
+
assert not is_valid_vehicle_number("K01AB1234")
|
|
55
|
+
assert not is_valid_vehicle_number("KA01AB123")
|