def test__removals_nor_changes__returns_no_items__when_item_is_put_back(): d = IdMapper({"a": 1}) del d["a"] d["a"] = 1 assert [(k, v) for k, v in d.removals()] == [] assert [(k, v) for k, v in d.additions()] == [] assert [(k, v) for k, v in d.changes()] == []
def test__changes__returns_item__when_it_is_first_deleted_and_then_changed(): d = IdMapper({"a": 1}) del d["a"] d["a"] = 2 assert [(k, v) for k, v in d.removals()] == [] assert [(k, v) for k, v in d.additions()] == [] assert [(k, v) for k, v in d.changes()] == [("a", 2)]
def test__removals__return_items_removed__when_removed_using_reversed_map(): d = IdMapper({"b": 2}) del d.reverse[2] assert [(k, v) for k, v in d.removals()] == [("b", 2)]
def test__removals__returns_no_items__when_added_item_is_added_and_removed(): d = IdMapper() d["a"] = 1 del d["a"] assert [(k, v) for k, v in d.removals()] == [] assert [(k, v) for k, v in d.additions()] == []
def test__removals__return_items_removed(): d = IdMapper({"b": 2}) del d["b"] assert [(k, v) for k, v in d.removals()] == [("b", 2)]