From 9f267cb9655d327e84c4fee1a2844a23d233ef5e Mon Sep 17 00:00:00 2001 From: DOUG Date: Wed, 31 Jul 2024 14:54:19 -0300 Subject: [PATCH] feat(issue-63): Translate comments to portuguese and remove non used if --- tests/test_CPF.py | 2 +- validate_docbr/CPF.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_CPF.py b/tests/test_CPF.py index 8de7a11..410b8c6 100644 --- a/tests/test_CPF.py +++ b/tests/test_CPF.py @@ -67,6 +67,6 @@ def test_add_leading_zeros(self): for cpf_input, expected_output in cases: self.assertEqual(self.cpf._complete_with_zeros(cpf_input), expected_output) - # Test if the input is already correct length, it should not add zeros + # Testa se a entrada ja tem o tamanho correto, não deve adicionar zeros self.assertEqual(self.cpf._complete_with_zeros('00123456789'), '00123456789') self.assertEqual(self.cpf._complete_with_zeros('23456789012'), '23456789012') \ No newline at end of file diff --git a/validate_docbr/CPF.py b/validate_docbr/CPF.py index 3f87eae..b8591c3 100644 --- a/validate_docbr/CPF.py +++ b/validate_docbr/CPF.py @@ -20,8 +20,6 @@ def validate(self, doc: str = '') -> bool: if len(doc) != 11: doc = self._complete_with_zeros(doc) - if len(doc) != 11: - return False if not self.repeated_digits and self._check_repeated_digits(doc): return False @@ -81,5 +79,4 @@ def _check_repeated_digits(self, doc: List[str]) -> bool: def _complete_with_zeros(self, doc: list[str]) -> list[str]: """Adiciona zeros a esquerda para completar o CPF.""" - return '0' * (11 - len(doc)) + str(doc)