def test_multimatchbox_indexed_not_match(characteristic_values): """ Check simple adding object to index if it does not match a certain characteristic's value. In this case object gets recorded on index. """ ob = IndexedObject(characteristic_values, False) matchbox = MatchBox("characteristic") matchbox.add(ob) values = matchbox.extract_characteristic_value(ob).values # get the values as sorting algorithms sees them assert set(values) == set(matchbox.index.keys()), "characteristic value should result in an entry in index." assert matchbox.exclude_unknown == set(), "object should not be matching any unknown values." for characteristic in values: assert ob in matchbox.index[characteristic], "Object should be in set under it's characteristic's value key."
def test_indexed_match(characteristic_values): """ Check simple adding object to index if it does match characteristic's value. In this case, objects is recorded on exclude_unknown. """ ob = IndexedObject(characteristic_values) matchbox = MatchBox("characteristic") matchbox.add(ob) values = matchbox.extract_characteristic_value(ob).values # get the values as sorting algorithms sees them assert set(values) == set(matchbox.index.keys()), "characteristic value should result in an entry in index." for characteristic in values: assert matchbox.index[characteristic] == set(), "But the entry should be empty." assert ob in matchbox.exclude_unknown, "object should be not matching any future entries though."