-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajustes na estrutura de tests pacientes
- Loading branch information
1 parent
9c260bd
commit 8b5370e
Showing
4 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
from unicodedata import numeric | ||
from django.test import TestCase | ||
from ..forms import PacienteForm | ||
import re | ||
|
||
|
||
class PacienteModelTests(TestCase): | ||
class PacienteFormTestCase(TestCase): | ||
|
||
validAlpha = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ\\-_\\s]+$" | ||
def setUp(self): | ||
|
||
validAlphaNumeric = "[A-Za-z0-9_À-ÿ.-_\\s]+$" | ||
self.alpha_pattern = "[A-Za-záàâãéèêíïóôõöúçñÁÀÂÃÉÈÍÏÓÔÕÖÚÇÑ\\-_\\s]+$" | ||
|
||
self.alpha_numeric_pattern = "[A-Za-z0-9_À-ÿ.-_\\s]+$" | ||
|
||
self.numeric_pattern = "[^0-9]" | ||
|
||
self.phone_number_pattern = "([0-9]{2})?([0-9]{2})([0-9]{4,5})([0-9]{4})" | ||
|
||
self.phone_number = "+55(62) +._=98833-91509" | ||
|
||
def test_acerto_para_formato_numerico_campo_telefone(self): | ||
|
||
self.assertTrue( | ||
re.sub(self.numeric_pattern, "", self.phone_number).isnumeric(), | ||
"Formato inválido para telefone", | ||
) | ||
|
||
def test_falha_no_formato_campo_nome(self): | ||
|
||
nome = "Tatiane Eliane. Aparício" | ||
|
||
self.assertIs(re.match(self.validAlpha, nome), None) | ||
self.assertIsNone(re.match(self.alpha_pattern, nome)) |
Empty file.
Empty file.