Skip to content

Commit e2a7cb4

Browse files
committed
No type check for array_attrables, add test for a hover_data dictionary
1 parent a457f0e commit e2a7cb4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Diff for: packages/python/plotly/plotly/express/_core.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1423,9 +1423,7 @@ def build_dataframe(args, constructor):
14231423
i for i in args.values() if isinstance(i, str) and i in columns
14241424
]
14251425
for field in args:
1426-
if field in array_attrables and isinstance(
1427-
args[field], (list, dict)
1428-
):
1426+
if args[field] is not None and field in array_attrables:
14291427
necessary_columns.extend(
14301428
[i for i in args[field] if i in columns]
14311429
)

Diff for: packages/python/plotly/plotly/tests/test_optional/test_px/test_px_input.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ def test_build_df_from_vaex_and_polars(test_lib):
332332
reason="plotly doesn't use a dataframe interchange protocol for pandas < 2.0.2",
333333
)
334334
@pytest.mark.parametrize("test_lib", ["vaex", "polars"])
335-
def test_build_df_with_hover_data_from_vaex_and_polars(test_lib):
335+
@pytest.mark.parametrize(
336+
"hover_data", [["sepal_width"], {"sepal_length": False, "sepal_width": ":.2f"}]
337+
)
338+
def test_build_df_with_hover_data_from_vaex_and_polars(test_lib, hover_data):
336339
if test_lib == "vaex":
337340
import vaex as lib
338341
else:
@@ -345,7 +348,7 @@ def test_build_df_with_hover_data_from_vaex_and_polars(test_lib):
345348
data_frame=iris_vaex,
346349
x="petal_width",
347350
y="sepal_length",
348-
hover_data=["sepal_width"],
351+
hover_data=hover_data,
349352
)
350353
out = build_dataframe(args, go.Scatter)
351354
assert_frame_equal(

0 commit comments

Comments
 (0)