oc-facho/tests/test_amount.py
bit4bit@riseup.net d97ff79137 facho/fe/form.py(Amount): solo permite positivos.
FossilOrigin-Name: 220d676ea89de7c4562375be0d71d0b8b410d146a828969d56fc30d1e4532835
2020-11-01 02:25:23 +00:00

23 lines
613 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of facho. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
"""Tests for `facho` package."""
import pytest
import facho.fe.form as form
def test_amount_positive():
with pytest.raises(ValueError):
form.Amount(-1.0)
def test_amount_equals():
price1 = form.Amount(110.0)
price2 = form.Amount(100 + 10.0)
assert price1 == price2
assert price1 == form.Amount(100) + form.Amount(10)
assert price1 == form.Amount(10) * form.Amount(10) + form.Amount(10)