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

[IMP] Library pattern and standards #23

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d36668c
Merge pull request #8 from akretion/FIX-gramatica_formatacao_texto
rvalyi Mar 17, 2018
2765a09
examplo real, importando uma nota processada
rvalyi Mar 20, 2018
8b3223a
better .gitignore for tests
rvalyi Mar 15, 2019
d305281
added basic input/output tests
rvalyi Mar 15, 2019
49c543e
.gitignore for tests
rvalyi Mar 15, 2019
bd6c689
subclass leiauteNFe for root tag and tag prefix
rvalyi Mar 15, 2019
ffba871
setup.py for Python 2.7 and 3.4+
rvalyi Mar 15, 2019
656a755
Travis CI attempt
rvalyi Mar 15, 2019
1a78fbf
Travis CI
rvalyi Mar 15, 2019
9ea47a9
attempt for README in Markdown
rvalyi Mar 15, 2019
be6612d
proper setup.py
rvalyi Mar 15, 2019
9bcd0a9
Update README.md
rvalyi Mar 15, 2019
974780c
make subclass export usable on any stream
rvalyi Mar 15, 2019
3cb4f2d
simplify in/out test
rvalyi Mar 15, 2019
dd62878
Update README.md
rvalyi Mar 15, 2019
a5fa3b2
better tests + inut
rvalyi Apr 20, 2019
e1fa2e4
travis fix
rvalyi Apr 20, 2019
9178454
documented generation light process
rvalyi Sep 29, 2020
ad2b89f
README
rvalyi Sep 29, 2020
3c2bbb1
drop EOL Python 2.7 support at neflib 0.3
rvalyi Sep 29, 2020
34c0bb9
leiauteNFe_sub fix now that retEnviNFe is used
rvalyi Sep 30, 2020
28196f5
v0.4: Pacote de Liberação Distribuição de DF-e v1.00
rvalyi Sep 30, 2020
c8f0a92
Pacote de Liberação Distribuição de DF-e v1.02
rvalyi Sep 30, 2020
1220b6e
Pacote de Liberação Evento Generico v1.01 (Atualizado em 30/05/2014)
rvalyi Oct 1, 2020
b9cf1b8
Pacote de Liberação Evento Canc v1.01 (30/05/2014)
rvalyi Oct 1, 2020
ed87ccf
IMPORTANT: geracao pacote por pacote para evitar override nos tipos b…
rvalyi Oct 1, 2020
c91413d
Pacote de Liberação Evento CCe v1.01 (30/05/2014)
rvalyi Oct 1, 2020
539ae98
Pacote de Liberação Evento Manifesta Destinatário v1.01 (30/05/2014)
rvalyi Oct 1, 2020
71ca61d
[IMP] Library pattern and standards
mileo Nov 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pacote de Liberação Evento CCe v1.01 (30/05/2014)
  • Loading branch information
rvalyi committed Oct 1, 2020
commit c91413d561206c0ab5a52ece279667fb5c2ec0ab
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -61,9 +61,13 @@ erpbrasil-edoc-gen-generate-python -n nfe -v v4.00 -i "distDFeInt|retDistDFeInt"
erpbrasil-edoc-gen-download-schema -n nfe -v v4.00 -u http://hom.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=YaiBe2csOmA=
erpbrasil-edoc-gen-generate-python -n nfe -v v4.00 -i "retEnvEvento" -d .

# Pacote de Liberação Evento Canc v1.01 (30/05/2014) (ZIP)
# Pacote de Liberação Evento Canc v1.01 (30/05/2014)
erpbrasil-edoc-gen-download-schema -n nfe -v v4.00 -u http://hom.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=MtjAJ1Rurjc=
erpbrasil-edoc-gen-generate-python -n nfe -v v4.00 -i "retEnvEventoCancNFe" -d .

# Pacote de Liberação Evento CCe v1.01 (30/05/2014)
erpbrasil-edoc-gen-download-schema -n nfe -v v4.00 -u https://www.nfe.fazenda.gov.br/portal/exibirArquivo.aspx?conteudo=P/FXaGiLKo0=
erpbrasil-edoc-gen-generate-python -n nfe -v v4.00 -i "retEnvCCe" -d .
```
Depois você pode olhar os arquivos Python geridos na pasta nfelib/v4_00/ e rodar os testes por examplo (`python3 -m pytest tests -v`).

@@ -72,7 +76,7 @@ Depois voce tem que trocar de branch de novo para a branch onde fica o codigo ge
```bash
rm -r nfelib
git checkout master_gen_v4_00
git merges master -X theirs
git merge master -X theirs
# gera de novo com o script acima (erpbrasil-edoc-gen-generate-python...)
# roda os tests para ver se esta tudo OK
python3 -m pytest tests -v
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><evento xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.00"><infEvento Id="ID1101103518080310245200017255001000047605169551186001"><cOrgao>35</cOrgao><tpAmb>1</tpAmb><CNPJ>75335849000115</CNPJ><chNFe>35180803102452000172550010000476051695511860</chNFe><dhEvento>2018-08-17T15:17:45-03:00</dhEvento><tpEvento>110110</tpEvento><nSeqEvento>1</nSeqEvento><verEvento>1.00</verEvento><detEvento versao="1.00"><descEvento>Carta de Correção</descEvento><xCorrecao>VOLUME: 4 VOLUMES</xCorrecao><xCondUso>A Carta de Correção é disciplinada pelo § 1º-A do art. 7º do Convênio S/N, de 15 de dezembro de 1970 e pode ser utilizada para regularização de erro ocorrido na emissão de documento fiscal, desde que o erro não esteja relacionado com: I - as variáveis que determinam o valor do imposto tais como: base de cálculo, alíquota, diferença de preço, quantidade, valor da operação ou da prestação; II - a correção de dados cadastrais que implique mudança do remetente ou do destinatário; III - a data de emissão ou de saída.</xCondUso></detEvento></infEvento></evento>
24 changes: 23 additions & 1 deletion tests/nfe/test_nfelib.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
from nfelib.v4_00 import retDistDFeInt
from nfelib.v4_00 import retEnvEvento
from nfelib.v4_00 import retEnvEventoCancNFe
from nfelib.v4_00 import retEnvCCe


def test_in_out_leiauteNFe():
@@ -89,8 +90,29 @@ def test_evento_cancelamento():
retEnvEventoCancNFe.infEventoType()
retEnvEventoCancNFe.detEventoType()

def test_cce():
retEnvCCe.infEventoType()
retEnvCCe.detEventoType()

def test_in_out_leiauteCCe():
path = 'tests/cce/v1_00/leiauteCCe'
for filename in os.listdir(path):
inputfile = '%s/%s' % (path, filename,)
doc = retInutNFe.parsexml_(inputfile, None)
obj = retEnvCCe.TEvento.factory().build(doc.getroot())

outputfile = 'tests/output.xml'
with open(outputfile, 'w') as f:
obj.export(f, level=0, name_='evento',
namespacedef_='xmlns="http://www.portalfiscal.inf.br/nfe"')

diff = main.diff_files(inputfile, outputfile)
print(diff)
assert len(diff) == 0

def test_init_all():
for mod in [nfe, retInutNFe, distDFeInt, retDistDFeInt, retEnvEvento, retEnvEventoCancNFe]:
for mod in [nfe, retInutNFe, distDFeInt, retDistDFeInt, retEnvEvento,
retEnvEventoCancNFe, retEnvCCe]:
for class_name in mod.__all__:
cls = getattr(mod, class_name)
if issubclass(cls, mod.GeneratedsSuper):