Exemplo n.º 1
0
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()] == []
Exemplo n.º 2
0
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)]
Exemplo n.º 3
0
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)]
Exemplo n.º 4
0
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()] == []
Exemplo n.º 5
0
def test__removals__return_items_removed():
    d = IdMapper({"b": 2})
    del d["b"]
    assert [(k, v) for k, v in d.removals()] == [("b", 2)]