Skip to main content

br-cpf-tester This is a test implementatipon of the Brazilian CPF Validation as part of the “Mão na Massa” proposal of the 4th module of Welcome to the Django training (http://welcometothedjango.com.br/).

CPF is a document that identifies a taxpayer at the Federal Internal Revenue Department. The CPF carries registration information supplied by the individual and by the Federal Internal Revenue Department database.

This number is currently formated as XXX.XXX.XXX-DD where X are digits and D are check digits.

https://travis-ci.org/Jaimenms/python-br-cpf-tester.svg?branch=master Code Health

Como desenvolver?

  1. Clone o repositório

  2. Crie um virtualenv com Python 3.6.

  3. Ative o virtualenv.

  4. Instale as dependências

  5. Execute os testes

git clone git@github.com:jaimenms/python-br-cpf-tester.git python brcpf
cd brcpf
python -m venv .brcpf
source .brcpf/bin/activate
pip install -r requirements.txt
pytest

Como instalar?

pip install br-cpf-tester

Como utilizar dentro de um validator.py no django?

from django.core.exceptions import ValidationError
from brcpftester import BrazilianCpfValidationTests

def validate_cpf(value):
    cpf = BrazilianCpfValidationTests()
    cpf(value)
    for test in cpf.tests:
        raise ValidationError(cpf.GetMessage(test), test)

Metadata

Release files for br-cpf-tester 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for br-cpf-tester 0.1.4
File Size Uploaded
br-cpf-tester-0.1.4.tar.gz 5.0 kB Details

Release files / br-cpf-tester-0.1.4.tar.gz

Download URL br-cpf-tester-0.1.4.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
01cc4ddb56b47ec1b4256c293c064637254c677e5f0ec7549fa855b9524c8ed6
BLAKE2b-256 checksum
How to use checksums
e9828a4733b6e42c7fb2861cc32b111790aac08e18b0600f9ece964b7c581fd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page