from inventory.pricing import discount, price


def test_price_includes_tax():
    assert price(100) == 120


def test_discount_caps_at_half():
    assert discount(100, 0.9) == 50
    assert discount(100, 0.1) == 90


def test_discount_rejects_negative():
    try:
        discount(100, -1)
    except ValueError:
        return
    raise AssertionError("negative discount accepted")
