brdocs-validation 0.2.0__tar.gz → 0.4.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.
Files changed (27) hide show
  1. {brdocs-validation-0.2.0/brdocs_validation.egg-info → brdocs_validation-0.4.0}/PKG-INFO +20 -14
  2. brdocs_validation-0.4.0/README.md +44 -0
  3. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/__init__.py +7 -0
  4. brdocs_validation-0.4.0/br_docs/validators/cert.py +26 -0
  5. brdocs_validation-0.4.0/br_docs/validators/sei.py +17 -0
  6. brdocs_validation-0.4.0/br_docs/validators/te.py +33 -0
  7. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0/brdocs_validation.egg-info}/PKG-INFO +20 -14
  8. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/brdocs_validation.egg-info/SOURCES.txt +3 -0
  9. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/pyproject.toml +5 -7
  10. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/tests/test_brdocs.py +28 -2
  11. brdocs-validation-0.2.0/README.md +0 -37
  12. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/LICENSE.txt +0 -0
  13. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/__init__.py +0 -0
  14. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/cnh.py +0 -0
  15. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/cnpj.py +0 -0
  16. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/cns.py +0 -0
  17. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/cpf.py +0 -0
  18. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/nis.py +0 -0
  19. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/renavam.py +0 -0
  20. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/types/__init__.py +0 -0
  21. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/br_docs/validators/types/format.py +0 -0
  22. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/brdocs_validation.egg-info/dependency_links.txt +0 -0
  23. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/brdocs_validation.egg-info/requires.txt +0 -0
  24. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/brdocs_validation.egg-info/top_level.txt +0 -0
  25. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/setup.cfg +0 -0
  26. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/tests/test_check_two_digits.py +0 -0
  27. {brdocs-validation-0.2.0 → brdocs_validation-0.4.0}/tests/test_format.py +0 -0
@@ -1,24 +1,23 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: brdocs-validation
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Validate brazilian documents using Type Hints in classes inheriting Pydantic's (V2) BaseModel
5
5
  Author-email: Vinícius Aguiar <vaguiararqdevsoftware@proton.me>
6
6
  Maintainer-email: Vinícius Aguiar <vaguiararqdevsoftware@proton.me>
7
7
  Project-URL: Repository, https://github.com/vinicius-oa/BRdocs-validation
8
- Keywords: pydantic-v2,cpf-validador,cnpj-validador
8
+ Keywords: pydantic-v2,cpf-validador,cnpj-validador,validador-pispasep,validador-titulo-eleitor
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Framework :: Pydantic :: 2
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Build Tools
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.10
22
21
  Description-Content-Type: text/markdown
23
22
  License-File: LICENSE.txt
24
23
  Requires-Dist: pydantic>=2.0
@@ -33,7 +32,7 @@ Requires-Dist: ruff; extra == "dev"
33
32
 
34
33
  ![Test](https://github.com/vinicius-oa/BRdocs-validation/actions/workflows/test.yml/badge.svg)
35
34
  ![codecov](https://codecov.io/gh/vinicius-oa/BRdocs-validation/graph/badge.svg?token=Z211YIKO8L)
36
- ![PyPI version](https://badge.fury.io/py/brdocs-validation.svg)
35
+ ![PyPI - Version](https://img.shields.io/pypi/v/brdocs-validation?label=pypi%20package&color=2334D058)
37
36
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/brdocs-validation?color=2334D058)
38
37
  ![Pydantic V2](https://img.shields.io/badge/Pydantic_V2->=2.0-2334D058.svg)
39
38
 
@@ -45,18 +44,22 @@ pip install brdocs-validation
45
44
 
46
45
  ## Supported docs and its formats
47
46
 
48
- | Supports | Description | Format | Format's support |
49
- |:-----------------:|:----------------------------------------:|:-----------------------------------------------:|:------------------:|
50
- | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
51
- | CPF | | *123.456.789-01* OR _Without special chars_ | |
52
- | CNH | | Only numbers | Length: _11_ |
53
- | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
54
- | CNS | Cartão Nacional de Saúde | Only numbers | |
55
- | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
47
+ | Supports | Description | Format | Format's support |
48
+ |:-----------------:|:-----------------------------------------:|:-----------------------------------------------:|:--------------------:|
49
+ | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
50
+ | CPF | | *123.456.789-01* OR _Without special chars_ | |
51
+ | CNH | | Only numbers | Length: _11_ |
52
+ | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
53
+ | CNS | Cartão Nacional de Saúde | Only numbers | |
54
+ | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
55
+ | TE | Título de eleitor | Only numbers | |
56
+ | CERT | Certidão de casamento, nascimento e óbito | Only numbers | |
57
+ | SEI | Número do Processo SEI | 12345-67890123/4567-89 OR without special chars | |
58
+
56
59
  ## Usage
57
60
 
58
61
  ```python
59
- from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM
62
+ from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM, TE, CERT, SEI
60
63
  from pydantic import BaseModel
61
64
 
62
65
 
@@ -67,4 +70,7 @@ class User(BaseModel):
67
70
  nis: NIS
68
71
  cns: CNS
69
72
  renavam: RENAVAM
73
+ te: TE
74
+ cert: CERT
75
+ sei: SEI
70
76
  ```
@@ -0,0 +1,44 @@
1
+ ![Test](https://github.com/vinicius-oa/BRdocs-validation/actions/workflows/test.yml/badge.svg)
2
+ ![codecov](https://codecov.io/gh/vinicius-oa/BRdocs-validation/graph/badge.svg?token=Z211YIKO8L)
3
+ ![PyPI - Version](https://img.shields.io/pypi/v/brdocs-validation?label=pypi%20package&color=2334D058)
4
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/brdocs-validation?color=2334D058)
5
+ ![Pydantic V2](https://img.shields.io/badge/Pydantic_V2->=2.0-2334D058.svg)
6
+
7
+ ## Install
8
+ ```
9
+ pip install brdocs-validation
10
+ ```
11
+
12
+
13
+ ## Supported docs and its formats
14
+
15
+ | Supports | Description | Format | Format's support |
16
+ |:-----------------:|:-----------------------------------------:|:-----------------------------------------------:|:--------------------:|
17
+ | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
18
+ | CPF | | *123.456.789-01* OR _Without special chars_ | |
19
+ | CNH | | Only numbers | Length: _11_ |
20
+ | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
21
+ | CNS | Cartão Nacional de Saúde | Only numbers | |
22
+ | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
23
+ | TE | Título de eleitor | Only numbers | |
24
+ | CERT | Certidão de casamento, nascimento e óbito | Only numbers | |
25
+ | SEI | Número do Processo SEI | 12345-67890123/4567-89 OR without special chars | |
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM, TE, CERT, SEI
31
+ from pydantic import BaseModel
32
+
33
+
34
+ class User(BaseModel):
35
+ cpf: CPF
36
+ cnpj: CNPJ
37
+ cnh: CNH
38
+ nis: NIS
39
+ cns: CNS
40
+ renavam: RENAVAM
41
+ te: TE
42
+ cert: CERT
43
+ sei: SEI
44
+ ```
@@ -1,12 +1,16 @@
1
1
  from pydantic.functional_validators import AfterValidator
2
2
  from typing_extensions import Annotated
3
3
 
4
+ from br_docs.validators.cert import CERTv
4
5
  from br_docs.validators.cnh import CNHv
5
6
  from br_docs.validators.cnpj import CNPJv
6
7
  from br_docs.validators.cns import CNSv
7
8
  from br_docs.validators.cpf import CPFv
8
9
  from br_docs.validators.nis import NISv
9
10
  from br_docs.validators.renavam import RENAVAMv
11
+ from br_docs.validators.te import TEv
12
+ from br_docs.validators.sei import SEIv
13
+
10
14
 
11
15
  CPF = Annotated[str, AfterValidator(CPFv())]
12
16
  CNPJ = Annotated[str, AfterValidator(CNPJv())]
@@ -14,3 +18,6 @@ CNH = Annotated[str, AfterValidator(CNHv())]
14
18
  NIS = Annotated[str, AfterValidator(NISv())]
15
19
  CNS = Annotated[str, AfterValidator(CNSv())]
16
20
  RENAVAM = Annotated[str, AfterValidator(RENAVAMv())]
21
+ TE = Annotated[str, AfterValidator(TEv())]
22
+ CERT = Annotated[str, AfterValidator(CERTv())]
23
+ SEI = Annotated[str, AfterValidator(SEIv())]
@@ -0,0 +1,26 @@
1
+ import re
2
+
3
+ from br_docs.validators import CheckDigits
4
+
5
+
6
+ class CERTv(CheckDigits):
7
+ """ Certidões de casamento, nascimento e óbito """
8
+ Patterns = re.compile(r"^\d{32}$"),
9
+ CHECK_DIGITS = 2
10
+ CertAlgarismsMultipliers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
11
+
12
+ @classmethod
13
+ def calculate_digits(cls, non_digits: list[int]) -> tuple[int, ...]:
14
+ """ https://web.archive.org/web/20240227052915/http://ghiorzi.org/DVnew.htm#zc """
15
+ def sum_(slice_: int = 1, value: int | None = None) -> int:
16
+ numbers = non_digits
17
+ if value is not None:
18
+ numbers.append(value)
19
+ digit = sum(x * y for x, y in zip(numbers, cls.CertAlgarismsMultipliers[slice_:])) % 11
20
+ if digit == 10:
21
+ return 1
22
+ return digit
23
+
24
+ digit_one = sum_()
25
+ digit_two = sum_(0, digit_one)
26
+ return digit_one, digit_two
@@ -0,0 +1,17 @@
1
+ import re
2
+
3
+ from pydantic_core import PydanticCustomError
4
+
5
+
6
+ class SEIv:
7
+ Patterns = re.compile(r'^\d{5}-?\d{8}/?\d{4}-?\d{2}$')
8
+
9
+ def __call__(self, value: str) -> str:
10
+ self.validate(value)
11
+ return value
12
+
13
+ def validate(self, value: str) -> str:
14
+ check_format = bool(self.Patterns.match(value))
15
+ if check_format is not True:
16
+ raise PydanticCustomError('invalid', 'Invalid Value')
17
+ return value
@@ -0,0 +1,33 @@
1
+ import re
2
+
3
+ from pydantic_core import PydanticCustomError
4
+
5
+ from br_docs.validators import CheckDigits
6
+
7
+
8
+ class TEv(CheckDigits):
9
+ """ Titulo de eleitor """
10
+ Patterns = re.compile(r"^\d{12}$"),
11
+
12
+ def validate(self, value: str):
13
+ valid_value = self.calculate_digits(list(map(int, value)))[0]
14
+ if not valid_value:
15
+ raise PydanticCustomError(
16
+ 'invalid',
17
+ 'invalid value'
18
+ )
19
+
20
+ @staticmethod
21
+ def calculate_digits(value: list[int]) -> tuple[int]:
22
+ """ https://web.archive.org/web/20240226104136/https://exceldoseujeito.com.br/validar-cpf-cnpj-e-titulo-de-eleitor-parte-ii/ """
23
+ check_digit_one = sum(x*y for x, y in zip(value[:8], range(2, 10))) % 11
24
+ if check_digit_one == 10:
25
+ check_digit_one = 0
26
+
27
+ value.append(check_digit_one)
28
+ check_digit_two = sum(x*y for x, y in zip(value[8:], range(7, 10))) % 11
29
+ if check_digit_two == 10:
30
+ check_digit_two = 0
31
+ if check_digit_one == value[-3] and check_digit_two == value[-2] and 0 < int(str(value[8]) + str(value[9])) < 29:
32
+ return 1,
33
+ return 0,
@@ -1,24 +1,23 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: brdocs-validation
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Validate brazilian documents using Type Hints in classes inheriting Pydantic's (V2) BaseModel
5
5
  Author-email: Vinícius Aguiar <vaguiararqdevsoftware@proton.me>
6
6
  Maintainer-email: Vinícius Aguiar <vaguiararqdevsoftware@proton.me>
7
7
  Project-URL: Repository, https://github.com/vinicius-oa/BRdocs-validation
8
- Keywords: pydantic-v2,cpf-validador,cnpj-validador
8
+ Keywords: pydantic-v2,cpf-validador,cnpj-validador,validador-pispasep,validador-titulo-eleitor
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Framework :: Pydantic :: 2
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Build Tools
13
13
  Classifier: License :: OSI Approved :: MIT License
14
14
  Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: Programming Language :: Python :: Implementation :: CPython
20
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.10
22
21
  Description-Content-Type: text/markdown
23
22
  License-File: LICENSE.txt
24
23
  Requires-Dist: pydantic>=2.0
@@ -33,7 +32,7 @@ Requires-Dist: ruff; extra == "dev"
33
32
 
34
33
  ![Test](https://github.com/vinicius-oa/BRdocs-validation/actions/workflows/test.yml/badge.svg)
35
34
  ![codecov](https://codecov.io/gh/vinicius-oa/BRdocs-validation/graph/badge.svg?token=Z211YIKO8L)
36
- ![PyPI version](https://badge.fury.io/py/brdocs-validation.svg)
35
+ ![PyPI - Version](https://img.shields.io/pypi/v/brdocs-validation?label=pypi%20package&color=2334D058)
37
36
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/brdocs-validation?color=2334D058)
38
37
  ![Pydantic V2](https://img.shields.io/badge/Pydantic_V2->=2.0-2334D058.svg)
39
38
 
@@ -45,18 +44,22 @@ pip install brdocs-validation
45
44
 
46
45
  ## Supported docs and its formats
47
46
 
48
- | Supports | Description | Format | Format's support |
49
- |:-----------------:|:----------------------------------------:|:-----------------------------------------------:|:------------------:|
50
- | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
51
- | CPF | | *123.456.789-01* OR _Without special chars_ | |
52
- | CNH | | Only numbers | Length: _11_ |
53
- | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
54
- | CNS | Cartão Nacional de Saúde | Only numbers | |
55
- | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
47
+ | Supports | Description | Format | Format's support |
48
+ |:-----------------:|:-----------------------------------------:|:-----------------------------------------------:|:--------------------:|
49
+ | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
50
+ | CPF | | *123.456.789-01* OR _Without special chars_ | |
51
+ | CNH | | Only numbers | Length: _11_ |
52
+ | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
53
+ | CNS | Cartão Nacional de Saúde | Only numbers | |
54
+ | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
55
+ | TE | Título de eleitor | Only numbers | |
56
+ | CERT | Certidão de casamento, nascimento e óbito | Only numbers | |
57
+ | SEI | Número do Processo SEI | 12345-67890123/4567-89 OR without special chars | |
58
+
56
59
  ## Usage
57
60
 
58
61
  ```python
59
- from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM
62
+ from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM, TE, CERT, SEI
60
63
  from pydantic import BaseModel
61
64
 
62
65
 
@@ -67,4 +70,7 @@ class User(BaseModel):
67
70
  nis: NIS
68
71
  cns: CNS
69
72
  renavam: RENAVAM
73
+ te: TE
74
+ cert: CERT
75
+ sei: SEI
70
76
  ```
@@ -3,12 +3,15 @@ README.md
3
3
  pyproject.toml
4
4
  br_docs/__init__.py
5
5
  br_docs/validators/__init__.py
6
+ br_docs/validators/cert.py
6
7
  br_docs/validators/cnh.py
7
8
  br_docs/validators/cnpj.py
8
9
  br_docs/validators/cns.py
9
10
  br_docs/validators/cpf.py
10
11
  br_docs/validators/nis.py
11
12
  br_docs/validators/renavam.py
13
+ br_docs/validators/sei.py
14
+ br_docs/validators/te.py
12
15
  br_docs/validators/types/__init__.py
13
16
  br_docs/validators/types/format.py
14
17
  brdocs_validation.egg-info/PKG-INFO
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "brdocs-validation"
7
- version = "0.2.0"
7
+ version = "0.4.0"
8
8
  dependencies = [
9
9
  "pydantic>=2.0"
10
10
  ]
11
- requires-python = ">= 3.9"
11
+ requires-python = ">= 3.10"
12
12
  authors = [
13
13
  {name = "Vinícius Aguiar", email = "vaguiararqdevsoftware@proton.me"},
14
14
  ]
@@ -17,7 +17,7 @@ maintainers = [
17
17
  ]
18
18
  description = "Validate brazilian documents using Type Hints in classes inheriting Pydantic's (V2) BaseModel"
19
19
  readme = "README.md"
20
- keywords = ["pydantic-v2", "cpf-validador", "cnpj-validador"]
20
+ keywords = ["pydantic-v2", "cpf-validador", "cnpj-validador", "validador-pispasep", "validador-titulo-eleitor"]
21
21
  classifiers = [
22
22
  "Development Status :: 5 - Production/Stable",
23
23
  "Framework :: Pydantic :: 2",
@@ -25,7 +25,6 @@ classifiers = [
25
25
  "Topic :: Software Development :: Build Tools",
26
26
  "License :: OSI Approved :: MIT License",
27
27
  "Natural Language :: English",
28
- "Programming Language :: Python :: 3.9",
29
28
  "Programming Language :: Python :: 3.10",
30
29
  "Programming Language :: Python :: 3.11",
31
30
  "Programming Language :: Python :: 3.12",
@@ -52,7 +51,7 @@ legacy_tox_ini = """
52
51
  [tox]
53
52
  requires =
54
53
  tox>=4
55
- env_list = py{39,310,311,312}-pydantic{20,21,22,23,24,25,26}
54
+ env_list = py{310,311,312}-pydantic{20,21,22,23,24,25,26}
56
55
  set_env =
57
56
  TEMP = {env_tmp_dir}
58
57
 
@@ -69,5 +68,4 @@ python =
69
68
  3.12 = py312-pydantic{20,21,22,23,24,25,26}
70
69
  3.11 = py311-pydantic{20,21,22,23,24,25,26}
71
70
  3.10 = py310-pydantic{20,21,22,23,24,25,26}
72
- 3.9 = py39-pydantic{20,21,22,23,24,25,26}
73
- """
71
+ """
@@ -1,9 +1,10 @@
1
1
  from contextlib import contextmanager
2
2
 
3
+ import pytest
3
4
  from pydantic import create_model
4
5
  from pydantic_core import ValidationError
5
6
 
6
- from br_docs import CNH, CPF, CNPJ, NIS, CNS, RENAVAM
7
+ from br_docs import CNH, CPF, CNPJ, NIS, CNS, RENAVAM, TE, CERT, SEI
7
8
 
8
9
 
9
10
  @contextmanager
@@ -14,7 +15,7 @@ def validate(model_name: str, values, value_type):
14
15
  m = create_model(model_name, param=(value_type, ...))
15
16
  m(param=value)
16
17
  except ValidationError as exc:
17
- assert False, f"{exc}: {value}"
18
+ raise exc
18
19
  yield
19
20
  finally:
20
21
  pass
@@ -48,3 +49,28 @@ def test_cns(cns_list):
48
49
  def test_renavam(renavam_list):
49
50
  with validate(model_name='TestRENAVAM', values=renavam_list, value_type=RENAVAM):
50
51
  pass
52
+
53
+
54
+ def test_te(te_list):
55
+ with validate(model_name='TestTE', values=te_list, value_type=TE):
56
+ pass
57
+
58
+
59
+ def test_cert(cert_list):
60
+ with validate(model_name='TestCERT', values=cert_list, value_type=CERT):
61
+ pass
62
+
63
+
64
+ def test_valid_sei(valid_sei_list):
65
+ with validate(model_name='TestSEI', values=valid_sei_list, value_type=SEI):
66
+ pass
67
+
68
+
69
+ def test_invalid_sei(invalid_sei_list):
70
+ with pytest.raises(ValidationError):
71
+ with validate(
72
+ model_name='TestSEI',
73
+ values=invalid_sei_list,
74
+ value_type=SEI,
75
+ ):
76
+ pass
@@ -1,37 +0,0 @@
1
- ![Test](https://github.com/vinicius-oa/BRdocs-validation/actions/workflows/test.yml/badge.svg)
2
- ![codecov](https://codecov.io/gh/vinicius-oa/BRdocs-validation/graph/badge.svg?token=Z211YIKO8L)
3
- ![PyPI version](https://badge.fury.io/py/brdocs-validation.svg)
4
- ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/brdocs-validation?color=2334D058)
5
- ![Pydantic V2](https://img.shields.io/badge/Pydantic_V2->=2.0-2334D058.svg)
6
-
7
- ## Install
8
- ```
9
- pip install brdocs-validation
10
- ```
11
-
12
-
13
- ## Supported docs and its formats
14
-
15
- | Supports | Description | Format | Format's support |
16
- |:-----------------:|:----------------------------------------:|:-----------------------------------------------:|:------------------:|
17
- | CNPJ | | *12.345.678/9012-34* OR _Without special chars_ | |
18
- | CPF | | *123.456.789-01* OR _Without special chars_ | |
19
- | CNH | | Only numbers | Length: _11_ |
20
- | NIS/PIS/PASEP/NIT | Use _**NIS**_ type for _PIS, PASEP, NIT_ | *123.45678.90-1* OR _Only numbers_ | |
21
- | CNS | Cartão Nacional de Saúde | Only numbers | |
22
- | RENAVAM | | Only numbers | Length: _9, 10 & 11_ |
23
- ## Usage
24
-
25
- ```python
26
- from br_docs import CNPJ, CPF, CNH, NIS, CNS, RENAVAM
27
- from pydantic import BaseModel
28
-
29
-
30
- class User(BaseModel):
31
- cpf: CPF
32
- cnpj: CNPJ
33
- cnh: CNH
34
- nis: NIS
35
- cns: CNS
36
- renavam: RENAVAM
37
- ```