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

Check completeness of facturas.txt file #93

Open
chazuttu opened this issue Aug 5, 2021 · 2 comments
Open

Check completeness of facturas.txt file #93

chazuttu opened this issue Aug 5, 2021 · 2 comments
Labels
good first issue Good for newcomers

Comments

@chazuttu
Copy link
Collaborator

chazuttu commented Aug 5, 2021

Please check that the saved invoice, factura.txt is complete
You could compare it with a previous saved file

Originally posted by @reingart in #71 (comment)

@chazuttu
Copy link
Collaborator Author

chazuttu commented Aug 5, 2021

There is some unicode error due to accented characters while comparing the .txt files in Python 2.

The below code was written to check if the files were same:

  def test_main_grabar():
       sys.argv = []
       sys.argv.append("--prueba")
       sys.argv.append("--grabar")
       main()
       f1 = open("facturas.txt", encoding="utf-8", errors="ignore")
       f2 = open("tests/facturas.txt",  encoding='utf-8', errors="ignore")
       d1 = f1.readlines()
       d2 = f2.readlines()
       f1.close()
       f2.close()
       diff = [x for x in d1 if x not in d2]

The test worked with Python 3 but gave the following error with Python 2:-

assert diff == []
E       AssertionError: assert ['1P0001     ...           \n'] == []
E         Left contains 3 more items, first extra item: '1P0001                         000000000100070000001331000000000013310000005Descripcion del producto P0001�Lorem ipsu...  0000123456000000000000000001234567890123Dato A                                                                     \n'
E         Full diff:
E         + []
E         - [u'1P0001                         000000000100070000001331000000000013310000005Descripcion del producto P0001\x0bLorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet Lorem ipsum sit amet                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              000000000000000               N 123456           0000123456000000000000000001234567890123Dato A                                                                     \n',
E         -  u'1                                          99            -000000001210000005Bonificacin/Descuento 10%                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         \n',
E         -  u'1                                          00                               Descripcin Ejemplo                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                \n']

There seems to be some unicode issue with the accented characters in the tests/formatos.txt file which is causing failure.

@chazuttu chazuttu mentioned this issue Aug 5, 2021
6 tasks
@reingart reingart added the good first issue Good for newcomers label Mar 26, 2022
@HanslettTheDev
Copy link
Collaborator

Hello, So if I understand, the problem is finding some way to verify the factruras.txt file has the complete data right??
If yes, is there an English version of the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants