예제 #1
0
class CpfTest(TestCase):
    def setUp(self):
        self.cpf_with_formatting = CPF('010.787.400-89')
        self.cpf_without_formatting = CPF('01078740089')

    def test_cpf_with_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate_size())

    def test_cpf_without_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate_size())

    def test_cpf_validate_size_return_false(self):
        cpf = CPF('1234567891')
        self.assertFalse(cpf.validate_size())

    def test_cpf_format_return_true(self):
        self.assertEqual(self.cpf_without_formatting.format(),
                         '010.787.400-89')

    def test_cpf_format_return_false(self):
        self.assertNotEqual(self.cpf_without_formatting.format(),
                            '01078740089')

    def test_cpf_cleaning_return_true(self):
        self.assertEqual(self.cpf_with_formatting.cleaning(), '01078740089')

    def test_cpf_cleaning_return_false(self):
        self.assertNotEqual(self.cpf_with_formatting.cleaning(),
                            '010787400-89')

    def test_cpf_with_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate())

    def test_cpf_with_formatting_validate_return_false(self):
        cpf = CPF('010.787.400-8')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_false(self):
        cpf = CPF('0107874008')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate())
예제 #2
0
class CpfTest(TestCase):

    def setUp(self):
        self.cpf_with_formatting = CPF('010.787.400-89')
        self.cpf_without_formatting = CPF('01078740089')

    def test_cpf_with_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate_size())

    def test_cpf_without_formatting_validate_suze_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate_size())

    def test_cpf_validate_size_return_false(self):
        cpf = CPF('1234567891')
        self.assertFalse(cpf.validate_size())

    def test_cpf_format_return_true(self):
        self.assertEqual(self.cpf_without_formatting.format(), '010.787.400-89')

    def test_cpf_format_return_false(self):
        self.assertNotEqual(self.cpf_without_formatting.format(), '01078740089')

    def test_cpf_cleaning_return_true(self):
        self.assertEqual(self.cpf_with_formatting.cleaning(), '01078740089')

    def test_cpf_cleaning_return_false(self):
        self.assertNotEqual(self.cpf_with_formatting.cleaning(),
            '010787400-89')

    def test_cpf_with_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_with_formatting.validate())

    def test_cpf_with_formatting_validate_return_false(self):
        cpf = CPF('010.787.400-8')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_false(self):
        cpf = CPF('0107874008')
        self.assertFalse(cpf.validate())

    def test_cpf_without_formatting_validate_return_true(self):
        self.assertTrue(self.cpf_without_formatting.validate())
예제 #3
0
 def test_cpf_without_formatting_validate_return_false(self):
     cpf = CPF('0107874008')
     self.assertFalse(cpf.validate())
예제 #4
0
 def test_cpf_with_formatting_validate_return_false(self):
     cpf = CPF('010.787.400-8')
     self.assertFalse(cpf.validate())
예제 #5
0
 def test_cpf_validate_size_return_false(self):
     cpf = CPF('1234567891')
     self.assertFalse(cpf.validate_size())
예제 #6
0
 def setUp(self):
     self.cpf_with_formatting = CPF('010.787.400-89')
     self.cpf_without_formatting = CPF('01078740089')
예제 #7
0
 def test_cpf_without_formatting_validate_return_false(self):
     cpf = CPF('0107874008')
     self.assertFalse(cpf.validate())
예제 #8
0
 def test_cpf_with_formatting_validate_return_false(self):
     cpf = CPF('010.787.400-8')
     self.assertFalse(cpf.validate())
예제 #9
0
 def test_cpf_validate_size_return_false(self):
     cpf = CPF('1234567891')
     self.assertFalse(cpf.validate_size())
예제 #10
0
 def setUp(self):
     self.cpf_with_formatting = CPF('010.787.400-89')
     self.cpf_without_formatting = CPF('01078740089')
예제 #11
0
 def format_cpf(self):
     return CPF(self.cpf).format()