Example #1
0
def test_drop():
    td = TabularData(["col1", "col2", "col3"])
    td.append(["foo", "bar", "baz"])
    assert list(td) == [["foo", "bar", "baz"]]
    td.drop("col2")
    assert td.keys() == ["col1", "col3"]
    assert list(td) == [["foo", "baz"]]
Example #2
0
def test_protected():
    td = TabularData(["col1", "col2", "col3", "other"])
    td.append(["foo", "bar", "baz", "other_val"])
    td.protect("col1", "col2")

    td.drop("col1", "col2", "col3", "other")
    assert td.keys() == ["col1", "col2"]
    assert list(td) == [["foo", "bar"]]

    td.unprotect("col2")

    td.drop("col1", "col2")
    assert td.keys() == ["col1"]
    assert list(td) == [["foo"]]