Skip to content

Commit

Permalink
Tests for Explorer lists (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristineguadelupe authored Jan 20, 2024
1 parent cb2cf09 commit 812faff
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 812faff

Please sign in to comment.