reconcile: Update tests with renamed module.
This commit is contained in:
parent
e1edffda9a
commit
965aeabde9
1 changed files with 11 additions and 5 deletions
|
@ -4,7 +4,7 @@ import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
from conservancy_beancount.reconcile.prototype_amex_reconciler import (
|
from conservancy_beancount.reconcile.statement_reconciler import (
|
||||||
match_statement_and_books,
|
match_statement_and_books,
|
||||||
remove_payee_junk,
|
remove_payee_junk,
|
||||||
date_proximity,
|
date_proximity,
|
||||||
|
@ -15,6 +15,10 @@ from conservancy_beancount.reconcile.prototype_amex_reconciler import (
|
||||||
totals,
|
totals,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# These data structures represent individual transactions as taken from the
|
||||||
|
# statement ("S") or the books ("B").
|
||||||
|
|
||||||
|
# Statement transaction examples.
|
||||||
S1 = {
|
S1 = {
|
||||||
'date': datetime.date(2022, 1, 1),
|
'date': datetime.date(2022, 1, 1),
|
||||||
'amount': decimal.Decimal('10.00'),
|
'amount': decimal.Decimal('10.00'),
|
||||||
|
@ -37,6 +41,7 @@ S3 = {
|
||||||
'line': 444,
|
'line': 444,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Books transaction examples.
|
||||||
B1 = {
|
B1 = {
|
||||||
'date': datetime.date(2022, 1, 1),
|
'date': datetime.date(2022, 1, 1),
|
||||||
'amount': decimal.Decimal('10.00'),
|
'amount': decimal.Decimal('10.00'),
|
||||||
|
@ -115,6 +120,11 @@ def test_one_exact_match():
|
||||||
statement = [S1]
|
statement = [S1]
|
||||||
books = [B1]
|
books = [B1]
|
||||||
assert match_statement_and_books(statement, books) == [
|
assert match_statement_and_books(statement, books) == [
|
||||||
|
# Match, match, notes.
|
||||||
|
#
|
||||||
|
# The matches are a list so we can implement subset-sum matching where
|
||||||
|
# multiple books transactions may match to a single statement
|
||||||
|
# transaction.
|
||||||
([S1], [B1], []),
|
([S1], [B1], []),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -180,8 +190,6 @@ def test_payee_mismatch_not_ok_when_multiple_that_amount_and_date():
|
||||||
([], [B3_payee_mismatch_2], ['no match']),
|
([], [B3_payee_mismatch_2], ['no match']),
|
||||||
]
|
]
|
||||||
|
|
||||||
# def test_subset_sum_with_same_date_and_payee():
|
|
||||||
|
|
||||||
def test_remove_payee_junk():
|
def test_remove_payee_junk():
|
||||||
assert remove_payee_junk('WIDGETSRUS INC PAYMENT 1') == 'WIDGETSRUS'
|
assert remove_payee_junk('WIDGETSRUS INC PAYMENT 1') == 'WIDGETSRUS'
|
||||||
assert remove_payee_junk('0000010017') == '10017'
|
assert remove_payee_junk('0000010017') == '10017'
|
||||||
|
@ -191,7 +199,6 @@ def test_date_proximity():
|
||||||
assert date_proximity(datetime.date(2021, 8, 23), datetime.date(2021, 8, 23) - datetime.timedelta(days=30)) == 0.5
|
assert date_proximity(datetime.date(2021, 8, 23), datetime.date(2021, 8, 23) - datetime.timedelta(days=30)) == 0.5
|
||||||
assert date_proximity(datetime.date(2021, 8, 23), datetime.date(2021, 8, 23) - datetime.timedelta(days=60)) == 0.0
|
assert date_proximity(datetime.date(2021, 8, 23), datetime.date(2021, 8, 23) - datetime.timedelta(days=60)) == 0.0
|
||||||
|
|
||||||
|
|
||||||
def test_remove_duplicate_words():
|
def test_remove_duplicate_words():
|
||||||
assert remove_duplicate_words('Hi Foo Kow FOO') == 'Hi Foo Kow'
|
assert remove_duplicate_words('Hi Foo Kow FOO') == 'Hi Foo Kow'
|
||||||
|
|
||||||
|
@ -240,7 +247,6 @@ def test_totals():
|
||||||
([], [B3_next_day], []),
|
([], [B3_next_day], []),
|
||||||
]) == (decimal.Decimal('10'), decimal.Decimal('20'), decimal.Decimal('30'))
|
]) == (decimal.Decimal('10'), decimal.Decimal('20'), decimal.Decimal('30'))
|
||||||
|
|
||||||
|
|
||||||
def test_payee_not_considered_if_check_id_present():
|
def test_payee_not_considered_if_check_id_present():
|
||||||
# These records match aside from check-id.
|
# These records match aside from check-id.
|
||||||
statement = [S3]
|
statement = [S3]
|
||||||
|
|
Loading…
Reference in a new issue