diff --git a/tests/test_reconcile.py b/tests/test_reconcile.py index b7085a3b30515dc7597ce24e4f92f21d93a72b47..48835b19d0f64bb3881349b0d52086eadea090c0 100644 --- a/tests/test_reconcile.py +++ b/tests/test_reconcile.py @@ -308,3 +308,21 @@ def test_subset_sum_match(): [], # No remaining statement trans. [], # No remaining books trans. ) + +def test_subset_passes_through_all_non_matches(): + """This was used to locate a bug where some of the non-matches had + gone missing due to mutation of books_trans.""" + statement_trans = [ + S1, # No match + S4, # Match + ] + books_trans = [ + B2, # No match + B4A, B4B, B4C, # Match + B3_next_day, B3_next_week, # No match + ] + assert subset_match(statement_trans, books_trans) == ( + [([S4], [B4A, B4B, B4C], [])], # Matched + [S1], # No match: preserved intact + [B2, B3_next_day, B3_next_week] # No match: preserved intact + )