Skip to content

Commit

Permalink
test dimensions_max_cardinality
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskruchten committed Jan 21, 2020
1 parent 16b0e67 commit 74184e0
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,36 @@ def test_funnel():
color=["0", "0", "0", "1", "1", "1"],
)
assert len(fig.data) == 2


def test_parcats_dimensions_max():
df = px.data.tips()

# default behaviour
fig = px.parallel_categories(df)
assert [d.label for d in fig.data[0].dimensions] == [
"sex",
"smoker",
"day",
"time",
"size",
]

# explicit subset of default
fig = px.parallel_categories(df, dimensions=["sex", "smoker", "day"])
assert [d.label for d in fig.data[0].dimensions] == ["sex", "smoker", "day"]

# shrinking max
fig = px.parallel_categories(df, dimensions_max_cardinality=4)
assert [d.label for d in fig.data[0].dimensions] == [
"sex",
"smoker",
"day",
"time",
]

# explicit superset of default, violating the max
fig = px.parallel_categories(
df, dimensions=["sex", "smoker", "day", "size"], dimensions_max_cardinality=4
)
assert [d.label for d in fig.data[0].dimensions] == ["sex", "smoker", "day", "size"]

0 comments on commit 74184e0

Please sign in to comment.