Skip to content

Commit 4f71626

Browse files
Remove special cases for valid codes
The special cases excluded from the validation represent valid codes, used in test environments.
1 parent da45d42 commit 4f71626

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/validators/i18n/es.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from validators.utils import validator
88

99

10-
def _nif_nie_validation(value: str, number_by_letter: Dict[str, str], special_cases: Set[str]):
10+
def _nif_nie_validation(value: str, number_by_letter: Dict[str, str]):
1111
"""Validate if the doi is a NIF or a NIE."""
12-
if value in special_cases or len(value) != 9:
12+
if len(value) != 9:
1313
return False
1414
value = value.upper()
1515
table = "TRWAGMYFPDXBNJZSQVHLCKE"
@@ -104,8 +104,7 @@ def es_nif(value: str, /):
104104
(ValidationError): If `value` is an invalid DOI string.
105105
"""
106106
number_by_letter = {"L": "0", "M": "0", "K": "0"}
107-
special_cases = {"X0000000T", "00000000T", "00000001R"}
108-
return _nif_nie_validation(value, number_by_letter, special_cases)
107+
return _nif_nie_validation(value, number_by_letter)
109108

110109

111110
@validator
@@ -137,7 +136,7 @@ def es_nie(value: str, /):
137136
number_by_letter = {"X": "0", "Y": "1", "Z": "2"}
138137
# NIE must must start with X Y or Z
139138
if value and value[0] in number_by_letter:
140-
return _nif_nie_validation(value, number_by_letter, {"X0000000T"})
139+
return _nif_nie_validation(value, number_by_letter)
141140
return False
142141

143142

0 commit comments

Comments
 (0)