def test_pop_invalid_pos(): grid = Grid(columns=["id", "a"]) row = {"id": Ref("myid"), "a": 1, "b": 2} grid.append(row) old = grid.pop(-1) assert grid assert not old
def test_pop_multiple_pos(): grid = Grid(columns=["id", "a"]) row = {"id": Ref("id2"), "a": 1, "b": 2} grid.append(row) old = grid.pop(0, 1) assert not grid assert id(old) == id(row)
def test_pop_key(): grid = Grid(columns=["id", "a"]) row = {"id": Ref("myid"), "a": 1, "b": 2} grid.append(row) old = grid.pop(Ref("myid")) assert not grid assert id(old) == id(row)
def test_pop_multiple_keys(): grid = Grid(columns=["id", "a"]) row1 = {"id": Ref("id1"), "a": 1, "b": 2} row2 = {"id": Ref("id2"), "a": 1, "b": 2} grid.append(row1) grid.append(row2) old = grid.pop(Ref("id1"), Ref("id2")) assert not grid assert id(old) == id(row1)