Spaces:
Runtime error
Runtime error
File size: 864 Bytes
abd8f87 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from decimal import Decimal
from invoice_reconciler.normalize import normalize_amount, normalize_invoice_number
def test_invoice_number_preserved():
assert normalize_invoice_number(" PW117330 ") == "PW117330"
assert normalize_invoice_number("PW117330") == "PW117330"
assert normalize_invoice_number("INV-100") == "INV-100"
def test_amount_currency_and_commas():
assert normalize_amount("$1,234.50") == Decimal("1234.50")
assert normalize_amount("1234.50") == Decimal("1234.50")
assert normalize_amount("$8.58") == Decimal("8.58")
def test_negative_amounts():
assert normalize_amount("($12.00)") == Decimal("-12.00")
assert normalize_amount("-12.00") == Decimal("-12.00")
def test_blank_amount():
assert normalize_amount("") is None
assert normalize_amount(None) is None
assert normalize_amount("N/A") is None
|