diff --git a/.prettierignore b/.prettierignore index 2824129a97..110e1a3cd6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,3 +9,4 @@ ts-rs/ rust/perspective-python/perspective/labextension/ rust/perspective-python/perspective.data/ rust/perspective-python/*/data +venv/ \ No newline at end of file diff --git a/rust/perspective-python/perspective/__init__.py b/rust/perspective-python/perspective/__init__.py index ba2d6b5e2a..8fb7437459 100644 --- a/rust/perspective-python/perspective/__init__.py +++ b/rust/perspective-python/perspective/__init__.py @@ -61,7 +61,7 @@ def from_server( server: Server, loop_callback=default_loop_cb, ): - """Create a new `Client` instance bound synchronously to an Python + """Create a new `Client` instance bound synchronously to a Python instance of `PerspectiveServer`.""" def handle_request(bytes): diff --git a/rust/perspective-python/perspective/tests/table/test_table.py b/rust/perspective-python/perspective/tests/table/test_table.py index 1f4e530855..ea4968bf4a 100644 --- a/rust/perspective-python/perspective/tests/table/test_table.py +++ b/rust/perspective-python/perspective/tests/table/test_table.py @@ -605,6 +605,24 @@ def test_float32_table_construction(self): assert tbl.size() == 2 assert tbl.schema() == {"a": "float", "b": "float"} + def test_constructor_and_update_congruence(self): + input_data = [{"a": 0}, {"a": 1}, {"a": 2}, {"a": 3} ,{"a": None}] + # a table constructed with a schema then update() + # ends up different than a table with data given on construction + # in respect to how it interacts with `index`. + # This test shows that through using the `limit` + + # will show [3,1,2] + t1 = Table(input_data, limit=3) + j1 = t1.view().to_json() + # as of right now, second row is 1 + assert j1 == [{"a": 3}, {"a": None}, {"a": 2}] + + t2 = Table({"a": "integer"}, limit=3) + t2.update(input_data) + j2 = t2.view().to_json() + assert j2 == [{"a": 3}, {"a": None}, {"a": 2}] + if __name__ == "__main__": import pytest