test_parser_ingdiba.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # -*- coding: utf-8 -*-
  2. import pytest
  3. import os
  4. import dingguo.parser.ingdiba
  5. project_root_path = os.path.realpath(os.path.join(__file__, '..', '..'))
  6. test_data_path = os.path.join(project_root_path, 'tests', 'data', 'ing-diba')
  7. def test_ingdiba_pdf_file_to_text_purchase():
  8. pdf_name = 'ING-DiBa_Postbox_2013-03-25_WP-Kauf - 60631041.pdf'
  9. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  10. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  11. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')
  12. def test_ingdiba_pdf_file_to_text_tax():
  13. pdf_name = 'ING-DiBa_Postbox_2013-12-27_KESt auf Erträge ausländischer Fonds.pdf'
  14. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  15. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  16. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')
  17. def test_ingdiba_pdf_file_to_text_statement():
  18. pdf_name = 'ING-DiBa_Postbox_2014-01-01_Depotauszug - 60631041.pdf'
  19. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  20. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  21. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')
  22. def test_ingdiba_pdf_file_to_text_divestiture():
  23. pdf_name = 'ING-DiBa_Postbox_2014-02-07_WP-Verkauf - 60631041.pdf'
  24. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  25. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  26. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')
  27. def test_ingdiba_pdf_file_to_text_loss_compensation():
  28. pdf_name = 'ING-DiBa_Postbox_2014-04-03_Verlustausgleich 2013.pdf'
  29. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  30. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  31. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')
  32. def test_ingdiba_pdf_file_to_text_dividend_distribution():
  33. pdf_name = 'ING-DiBa_Postbox_2014-04-09_Jährl. Bestätigung Ausschüttung Fonds.pdf'
  34. with open(os.path.join(test_data_path, pdf_name)) as pdf_file:
  35. with open(os.path.join(test_data_path, os.path.splitext(pdf_name)[0] + '.txt')) as text_file:
  36. assert dingguo.parser.ingdiba.ingdiba_pdf_file_to_text(pdf_file) == text_file.read().decode('utf-8')