Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to brazilian company IDs (CNPJ) #411

Merged
merged 3 commits into from Oct 28, 2016

Conversation

Projects
None yet
3 participants
@lamenezes
Copy link
Contributor

commented Oct 28, 2016

This PR implments methods that provides pt-br company ids a.k.a. CNPJ [1] [2]

[1] https://en.wikipedia.org/wiki/CNPJ
[2] https://pt.wikipedia.org/wiki/Cadastro_Nacional_da_Pessoa_Jur%C3%ADdica#Algoritmo_de_Valida.C3.A7.C3.A3o

@ladylovelace

This comment has been minimized.

Copy link

commented Oct 28, 2016

This would be very helpful.
Good collaboration @lamenezes


@classmethod
def company_id(cls):
digits = random.sample(range(10), 8) + [0, 0, 0, 1]

This comment has been minimized.

Copy link
@fcurella

fcurella Oct 28, 2016

Collaborator

instead of the global random module, you should use the provider's own random instance, so that it can be frozen. Simply call cls.random_sample, instead of random.sample. The API is the same

This comment has been minimized.

Copy link
@lamenezes

lamenezes Oct 28, 2016

Author Contributor

updated

@fcurella

This comment has been minimized.

Copy link
Collaborator

commented Oct 28, 2016

Thank you very much! Great work!

@fcurella fcurella merged commit aa0b3a6 into joke2k:master Oct 28, 2016

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.02%) to 94.509%
Details

@lamenezes lamenezes deleted the lamenezes:pt-br-company-id branch Oct 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.