def test_determine_accumulated_attributes_basic_remove(self): accumulation_order = [ { "attribute_1": "something" }, { f"{ALL_ACCUMULATING_ATTRIBUTES[0]}_remove": ["2", "3"] }, { ALL_ACCUMULATING_ATTRIBUTES[0]: ["1", "2", "3"] }, ] expected_attributes = {ALL_ACCUMULATING_ATTRIBUTES[0]: ["1"]} result = _determine_accumulated_attributes(accumulation_order) self.assertEqual(result, expected_attributes)
def test_combination_multiple_attributes(self): accumulation_order = [ { f"{ALL_ACCUMULATING_ATTRIBUTES[0]}_add": ["2", "3"] }, { f"{ALL_ACCUMULATING_ATTRIBUTES[1]}_remove": ["B", "C"] }, { ALL_ACCUMULATING_ATTRIBUTES[0]: ["1"] }, { ALL_ACCUMULATING_ATTRIBUTES[1]: ["A", "B", "C"] }, ] expected_attributes = { ALL_ACCUMULATING_ATTRIBUTES[0]: ["1", "2", "3"], ALL_ACCUMULATING_ATTRIBUTES[1]: ["A"], } result = _determine_accumulated_attributes(accumulation_order) self.assertEqual(result, expected_attributes)