Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)