Skip to content

Commit

Permalink
Ajustando a função is_valid para melhorar a implementação dos testes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniamaia committed Jul 1, 2023
1 parent e103e0b commit 114019c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion brutils/cnpj.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def is_valid(cnpj): # type: (str) -> bool
Using this method name to match with the js library api.
Using the same method to ensure backwards compatibility.
"""
return validate(cnpj)
return isinstance(cnpj, str) and validate(cnpj)


def generate(branch=1): # type: (int) -> str
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cnpj.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def test_is_valid(self):

# When CNPJ is valid
assert is_valid("34665388000161")
assert not is_valid("52599927000100")
assert not is_valid("00000000000")
assert is_valid("01838723000127")

def test_generate(self):
for i in range(1000):
Expand Down

0 comments on commit 114019c

Please sign in to comment.