test_item.py 639 B

1234567891011121314151617181920212223
  1. import pytest
  2. import copy
  3. import finoex
  4. def get_item_a(sub_count=0):
  5. i = finoex.Item(name='test', price_brutto=finoex.Sum(2.0, 'EUR'))
  6. for c in range(sub_count):
  7. i.sub_items.append(finoex.Item(
  8. name='sub',
  9. price_brutto=finoex.Sum(1.0, 'EUR'),
  10. ))
  11. return i
  12. @pytest.mark.parametrize(('item', 'expected_total'), [
  13. [get_item_a(sub_count=0), finoex.Sum(2.0, 'EUR')],
  14. [get_item_a(sub_count=1), finoex.Sum(3.0, 'EUR')],
  15. [get_item_a(sub_count=2), finoex.Sum(4.0, 'EUR')],
  16. ])
  17. def test_total_price_brutto(item, expected_total):
  18. assert expected_total == item.total_price_brutto