Skip to content

Commit

Permalink
Tests for Explorer lists
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe committed Jan 20, 2024
1 parent cb2cf09 commit d0d3f2e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/kino/explorer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,44 @@ defmodule Kino.ExplorerTest do
} = data
end

test "support data summary for lists with nil" do
df = Explorer.DataFrame.new(%{list: Explorer.Series.from_list([[1, 2], [1], nil])})

widget = Kino.Explorer.new(df)
data = connect(widget)

assert %{
content: %{
columns: [
%{
key: "0",
label: "list",
summary: %{
keys: ["unique", "top", "top freq", "nulls"],
values: ["3", "[1, 2]", "1", "1"]
},
type: "list"
}
]
}
} = data
end

test "does not break on lists with internal nulls" do
df = Explorer.DataFrame.new(%{list: Explorer.Series.from_list([[1, 2], [1, nil]])})

widget = Kino.Explorer.new(df)
data = connect(widget)

assert %{
content: %{
columns: [
%{key: "0", label: "list", summary: %{keys: [], values: []}, type: "list"}
]
}
} = data
end

test "shows if a column is in a group when there are groups" do
df =
Explorer.DataFrame.new(%{
Expand Down

0 comments on commit d0d3f2e

Please sign in to comment.