Skip to content

Commit 9b2154e

Browse files
committed
add fixture
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 2fec0b2 commit 9b2154e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
from plotly.express._core import build_dataframe
88
from pandas.testing import assert_frame_equal
99

10+
# Fixtures
11+
# --------
12+
@pytest.fixture
13+
def add_interchange_module_for_old_pandas():
14+
if not hasattr(pd.api, "interchange"):
15+
pd.api.interchange = mock.MagicMock()
16+
# to make the following import work: `import pandas.api.interchange`
17+
with mock.patch.dict("sys.modules", {"pandas.api.interchange": pd.api.interchange}):
18+
yield
19+
else:
20+
yield
21+
1022

1123
def test_numpy():
1224
fig = px.scatter(x=[1, 2, 3], y=[2, 3, 4], color=[1, 3, 9])
@@ -234,7 +246,7 @@ def test_build_df_with_index():
234246
assert_frame_equal(tips.reset_index()[out["data_frame"].columns], out["data_frame"])
235247

236248

237-
def test_build_df_using_interchange_protocol_mock():
249+
def test_build_df_using_interchange_protocol_mock(add_interchange_module_for_old_pandas):
238250
class CustomDataFrame:
239251
def __dataframe__(self):
240252
pass

0 commit comments

Comments
 (0)