import pytest

from shop.orders import Order, total


def test_total_is_computed():
    assert total([Order(2), Order(3)]) == 5


def test_negative_amount_is_refused():
    with pytest.raises(ValueError):
        Order(-1)


def test_rounding(check_rounding):
    check_rounding(total([Order(1)]))


class TestOrder:
    def test_order_keeps_amount(self):
        self.assertEqual(Order(1).amount, 1)


def helper_without_assert():
    total([])
