@@ -305,6 +305,24 @@ def test_subset_sum_match():
books = [B4A, B4B, B4C]
assert subset_match(statement, books) == (
[([S4], [B4A, B4B, B4C], [])],
[], # 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