def test_viewer_update_df(self): table = Table({"a": [1, 2, 3]}) viewer = PerspectiveViewer() viewer.load(table) viewer.update(pd.DataFrame({"a": [4, 5, 6]})) assert table.size() == 6 assert viewer.table.size() == 6 assert viewer.table.view().to_dict() == {"a": [1, 2, 3, 4, 5, 6]}
def test_viewer_update_list(self): table = Table({"a": [1, 2, 3]}) viewer = PerspectiveViewer() viewer.load(table) viewer.update([{"a": 4}, {"a": 5}, {"a": 6}]) assert table.size() == 6 assert viewer.table.size() == 6 assert viewer.table.view().to_dict() == {"a": [1, 2, 3, 4, 5, 6]}
def test_viewer_update_dict_partial(self): table = Table({"a": [1, 2, 3], "b": [5, 6, 7]}, index="a") viewer = PerspectiveViewer() viewer.load(table) viewer.update({"a": [1, 2, 3], "b": [8, 9, 10]}) assert table.size() == 3 assert viewer.table.size() == 3 assert viewer.table.view().to_dict() == { "a": [1, 2, 3], "b": [8, 9, 10] }