Skip to content

Commit ce8fb9a

Browse files
committed
rm unused narwhals wrapper
1 parent 6f1389f commit ce8fb9a

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

packages/python/plotly/plotly/tests/test_optional/test_px/test_px.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def test_labels(constructor):
102102
)
103103
def test_line_mode(constructor, extra_kwargs, expected_mode):
104104
data = px.data.gapminder().to_dict(orient="list")
105-
gapminder = nw.from_native(constructor(data))
105+
gapminder = constructor(data)
106106

107107
fig = px.line(
108-
gapminder.to_native(),
108+
gapminder,
109109
x="year",
110110
y="pop",
111111
color="country",
@@ -119,7 +119,7 @@ def test_px_templates(constructor):
119119
import plotly.graph_objects as go
120120

121121
data = px.data.tips().to_dict(orient="list")
122-
tips = nw.from_native(constructor(data))
122+
tips = constructor(data)
123123

124124
# use the normal defaults
125125
fig = px.scatter()
@@ -146,7 +146,7 @@ def test_px_templates(constructor):
146146

147147
# read colorway from the template
148148
fig = px.scatter(
149-
tips.to_native(),
149+
tips,
150150
x="total_bill",
151151
y="tip",
152152
color="sex",
@@ -156,23 +156,21 @@ def test_px_templates(constructor):
156156
assert fig.data[1].marker.color == "blue"
157157

158158
# default colorway fallback
159-
fig = px.scatter(
160-
tips.to_native(), x="total_bill", y="tip", color="sex", template=dict()
161-
)
159+
fig = px.scatter(tips, x="total_bill", y="tip", color="sex", template=dict())
162160
assert fig.data[0].marker.color == px.colors.qualitative.D3[0]
163161
assert fig.data[1].marker.color == px.colors.qualitative.D3[1]
164162

165163
# pio default template colorway fallback
166164
pio.templates.default = "seaborn"
167165
px.defaults.template = None
168-
fig = px.scatter(tips.to_native(), x="total_bill", y="tip", color="sex")
166+
fig = px.scatter(tips, x="total_bill", y="tip", color="sex")
169167
assert fig.data[0].marker.color == pio.templates["seaborn"].layout.colorway[0]
170168
assert fig.data[1].marker.color == pio.templates["seaborn"].layout.colorway[1]
171169

172170
# pio default template colorway fallback
173171
pio.templates.default = "seaborn"
174172
px.defaults.template = "ggplot2"
175-
fig = px.scatter(tips.to_native(), x="total_bill", y="tip", color="sex")
173+
fig = px.scatter(tips, x="total_bill", y="tip", color="sex")
176174
assert fig.data[0].marker.color == pio.templates["ggplot2"].layout.colorway[0]
177175
assert fig.data[1].marker.color == pio.templates["ggplot2"].layout.colorway[1]
178176

@@ -190,7 +188,7 @@ def test_px_templates(constructor):
190188
pio.templates.default = "none"
191189
px.defaults.template = None
192190
fig = px.scatter(
193-
tips.to_native(),
191+
tips,
194192
x="total_bill",
195193
y="tip",
196194
marginal_x="histogram",
@@ -202,7 +200,7 @@ def test_px_templates(constructor):
202200
assert fig.layout.yaxis3.showgrid
203201

204202
fig = px.scatter(
205-
tips.to_native(),
203+
tips,
206204
x="total_bill",
207205
y="tip",
208206
marginal_x="histogram",
@@ -215,7 +213,7 @@ def test_px_templates(constructor):
215213
assert fig.layout.yaxis3.showgrid is None
216214

217215
fig = px.scatter(
218-
tips.to_native(),
216+
tips,
219217
x="total_bill",
220218
y="tip",
221219
marginal_x="histogram",
@@ -306,9 +304,9 @@ def test_permissive_defaults():
306304

307305
def test_marginal_ranges(constructor):
308306
data = px.data.tips().to_dict(orient="list")
309-
df = nw.from_native(constructor(data))
307+
df = constructor(data)
310308
fig = px.scatter(
311-
df.to_native(),
309+
df,
312310
x="total_bill",
313311
y="tip",
314312
marginal_x="histogram",

packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def test_sunburst_treemap_with_path(constructor):
154154

155155
# Error when values cannot be converted to numerical data type
156156
df = nw.from_native(df)
157-
native_namespace = df.__native_namespace__()
157+
native_namespace = nw.get_native_namespace(df)
158158
df = df.with_columns(
159159
values=nw.new_series(
160160
"values",
@@ -259,7 +259,7 @@ def test_sunburst_treemap_with_path_color(constructor):
259259
name="hover",
260260
values=hover,
261261
dtype=nw.String(),
262-
native_namespace=df.__native_namespace__(),
262+
native_namespace=nw.get_native_namespace(df),
263263
)
264264
)
265265
fig = px.sunburst(df.to_native(), path=path, color="calls", hover_data=["hover"])

packages/python/plotly/plotly/tests/test_optional/test_px/test_px_wide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def test_is_col_list(constructor):
1313
df_input = nw.from_native(constructor(dict(a=[1, 2], b=[1, 2])))
14-
native_namespace = df_input.__native_namespace__()
14+
native_namespace = nw.get_native_namespace(df_input)
1515
columns = df_input.columns
1616
df_input = df_input.to_native()
1717
is_pd_like = nw.dependencies.is_pandas_like_dataframe(df_input)

0 commit comments

Comments
 (0)