DANFSE: corrige erro de conversão float quando pis/cofins vazios#159
Merged
Conversation
Trata o caso em que o elemento piscofins existe no XML mas as tags vPis e vCofins estão ausentes, evitando ValueError ao gerar o DANFSe. Co-authored-by: Leonardo Gregianin <leogregianin@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
==========================================
+ Coverage 95.49% 95.65% +0.15%
==========================================
Files 32 32
Lines 4393 4393
Branches 311 311
==========================================
+ Hits 4195 4202 +7
+ Misses 131 125 -6
+ Partials 67 66 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
Corrige
ValueError: could not convert string to float: ''ao gerar DANFSe quando o elemento<piscofins>existe no XML mas as tags<vPis>e<vCofins>estão ausentes.Substitui a #158 com:
float(pis or 0) + float(cofins or 0)), sem helper novo nemtry/exceptredundante*_hom.pdfficam intactos, já que a fixture de homologação não muda)Fecha #158.
Co-authored-by: @leogregianin
Test plan
pytest tests/test_danfse.pypassa localmente comqpdfinstalado (mesma comparação do CI)test_cli.pypor dep ausente local)