Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ ts-rs/
rust/perspective-python/perspective/labextension/
rust/perspective-python/perspective.data/
rust/perspective-python/*/data
venv/
2 changes: 1 addition & 1 deletion rust/perspective-python/perspective/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
18 changes: 18 additions & 0 deletions rust/perspective-python/perspective/tests/table/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down