|
|
|
|
@ -64,6 +64,20 @@ def test_full_card_sections_installments_credit_and_payment():
|
|
|
|
|
assert rows[3].description == 'unknown text' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_partial_card_skips_metadata_and_parses_payment_with_variable_identifiers(): |
|
|
|
|
parsed = parse_document(( |
|
|
|
|
'SYNTHETIC INVOICE HEADER\n' |
|
|
|
|
'15/01 PGTO DEBITO CONTA 0001 123456789 123 123 -100,00 0,00\n' |
|
|
|
|
).encode(), 'OUROCARD_PARTIAL_V1', {'start_date': '2025-02-01', 'end_date': '2026-01-31'}) |
|
|
|
|
|
|
|
|
|
rows = normalize(parsed) |
|
|
|
|
|
|
|
|
|
assert parsed.skipped['metadata'] == 1 |
|
|
|
|
assert len(rows) == 1 |
|
|
|
|
assert rows[0].errors == () |
|
|
|
|
assert rows[0].kind == 'TRANSFER' |
|
|
|
|
assert rows[0].amount == '100.00' |
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('country', ['ESTADOS', 'Brasil']) |
|
|
|
|
def test_full_card_accepts_extended_country_layout(country): |
|
|
|
|
row = card(alternate_full_card_line(country=country))[0] |
|
|
|
|
@ -75,6 +89,7 @@ def test_full_card_accepts_extended_country_layout(country):
|
|
|
|
|
def test_card_ambiguity_bad_shapes_and_installments_block(): |
|
|
|
|
assert 'AMBIGUOUS_AMOUNT' in card(card_line(debit='2,00', credit='1,00'))[0].errors |
|
|
|
|
assert 'INVALID_ROW' in card('15.02.2026 MALFORMED')[0].errors |
|
|
|
|
assert 'INVALID_ROW' in card('15/01 MALFORMED', True)[0].errors |
|
|
|
|
assert 'INVALID_INSTALLMENT' in card(card_line(body='LOJA PARC 3/2'))[0].errors |
|
|
|
|
assert 'INVALID_AMOUNT' in card(card_line(debit='1.23,00'))[0].errors |
|
|
|
|
|
|
|
|
|
|