Skip to content

Commit 0199582

Browse files
committed
Remove np.nan and np.inf aliases no longer present in numpy2
1 parent c604379 commit 0199582

File tree

1 file changed

+6
-6
lines changed
  • packages/python/plotly/plotly/tests/test_optional/test_utils

1 file changed

+6
-6
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
## JSON encoding
3636
numeric_list = [1, 2, 3]
37-
np_list = np.array([1, 2, 3, np.NaN, np.NAN, np.Inf, dt(2014, 1, 5)])
37+
np_list = np.array([1, 2, 3, np.nan, np.inf, dt(2014, 1, 5)])
3838
mixed_list = [
3939
1,
4040
"A",
@@ -45,7 +45,7 @@
4545
dt_list = [dt(2014, 1, 5), dt(2014, 1, 5, 1, 1, 1), dt(2014, 1, 5, 1, 1, 1, 1)]
4646

4747
df = pd.DataFrame(
48-
columns=["col 1"], data=[1, 2, 3, dt(2014, 1, 5), pd.NaT, np.NaN, np.Inf]
48+
columns=["col 1"], data=[1, 2, 3, dt(2014, 1, 5), pd.NaT, np.nan, np.inf]
4949
)
5050

5151
rng = pd.date_range("1/1/2011", periods=2, freq="H")
@@ -184,7 +184,7 @@ def test_figure_json_encoding(self):
184184

185185
assert (
186186
js1 == '{"type": "scatter3d", "x": [1, 2, 3], '
187-
'"y": [1, 2, 3, null, null, null, "2014-01-05T00:00:00"], '
187+
'"y": [1, 2, 3, null, null, "2014-01-05T00:00:00"], '
188188
'"z": [1, "A", "2014-01-05T00:00:00", '
189189
'"2014-01-05T01:01:01", "2014-01-05T01:01:01.000001"]}'
190190
)
@@ -195,9 +195,9 @@ def test_figure_json_encoding(self):
195195
_json.dumps(figure, cls=utils.PlotlyJSONEncoder, sort_keys=True)
196196

197197
# Test data wasn't mutated
198-
np_array = np.array([1, 2, 3, np.NaN, np.NAN, np.Inf, dt(2014, 1, 5)])
198+
np_array = np.array([1, 2, 3, np.nan, np.inf, dt(2014, 1, 5)])
199199
for k in range(len(np_array)):
200-
if k in [3, 4]:
200+
if k == 3:
201201
# check NaN
202202
assert np.isnan(np_list[k]) and np.isnan(np_array[k])
203203
else:
@@ -237,7 +237,7 @@ def test_pandas_json_encoding(self):
237237
# Test that data wasn't mutated
238238
assert_series_equal(
239239
df["col 1"],
240-
pd.Series([1, 2, 3, dt(2014, 1, 5), pd.NaT, np.NaN, np.Inf], name="col 1"),
240+
pd.Series([1, 2, 3, dt(2014, 1, 5), pd.NaT, np.nan, np.inf], name="col 1"),
241241
)
242242

243243
j2 = _json.dumps(df.index, cls=utils.PlotlyJSONEncoder)

0 commit comments

Comments
 (0)