8000 add test for loading px datasets · plotly/plotly.py@17e0147 · GitHub
[go: up one dir, main page]

Skip to content

Commit 17e0147

Browse files
committed
add test for loading px datasets
1 parent 76ca2a3 commit 17e0147

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

plotly/tests/test_optional/test_px/test_px.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,3 +375,22 @@ def test_empty_df_int64(backend):
375375
)
376376
# to_dict() should not raise an exception
377377
fig.to_dict()
378+
379+
380+
@pytest.mark.parametrize("return_type", ["pandas", "polars", "pyarrow"])
381+
def test_load_px_data(return_type):
382+
# Test that all px.data functions can be called without error
383+
data_func_names = [
384+
f
385+
for f in dir(px.data)
386+
if not f.startswith("_")
387+
and callable(getattr(px.data, f))
388+
and not f == "import_module"
389+
]
390+
for fname in data_func_names:
391+
if fname == "election_geojson":
392+
# As a geojson file, election_geojson does not support the return_type argument
393+
df = getattr(px.data, fname)()
394+
else:
395+
df = getattr(px.data, fname)(return_type=return_type)
396+
assert len(df) > 0

0 commit comments

Comments
 (0)
0