Skip to content

Commit

Permalink
test: Atualiza configurações de coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofpp committed Feb 24, 2024
1 parent afdcd86 commit b89fd42
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
source = validate_docbr
disable_warnings = no-data-collected

[report]
fail_under = 97.50
precision = 2
show_missing = True
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from tests import *
35 changes: 34 additions & 1 deletion tests/test_CNPJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,44 @@ def test_mask(self):
self.assertEqual(masked_cnpj, '11.222.333/4444-55')

def test_special_case(self):
""" Verifica os casos especiais de CNPJ """
"""Verifica os casos especiais de CNPJ."""
cases = [
('00000-000/0000', False),
('AAAA0AAAAAAA2AAAAAA', False),
('74600269000145', True),
]
for cnpj, is_valid in cases:
self.assertEqual(self.cnpj.validate(cnpj), is_valid)

def test_validate_success(self):
"""Testar o método validate do CNPJ."""
# GIVEN
doc = '74600269000145'

# WHEN
validate_return = self.cnpj.validate(doc)

# THEN
self.assertTrue(validate_return)

def test_validate_wrong_input(self):
"""Testar o método validate do CNPJ em caso de input errado."""
# GIVEN
doc = '74600269000145_'

# WHEN
validate_return = self.cnpj.validate(doc)

# THEN
self.assertFalse(validate_return)

def test_validate_wrong_length(self):
"""Testar o método validate do CNPJ em caso de tamanho inválido."""
# GIVEN
doc = '746002690001450'

# WHEN
validate_return = self.cnpj.validate(doc)

# THEN
self.assertFalse(validate_return)
4 changes: 2 additions & 2 deletions tests/test_generic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
import random
import unittest

import validate_docbr as docbr

Expand Down Expand Up @@ -34,7 +34,7 @@ def test_correct_argument(self):

# Documentos aleatórios
len_doc = len(DocClass().generate())
for i in range(200):
for _ in range(200):
random_doc = get_random_number_str(len_doc)
documents += [(DocClass, random_doc)]
right_answers += [DocClass().validate(random_doc)]
Expand Down

0 comments on commit b89fd42

Please sign in to comment.