Skip to content

Commit 10b2b87

Browse files
committed
Merge with master
2 parents 4573074 + 19b611d commit 10b2b87

22 files changed

+35
-11314
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ commands:
7979
name: Test dependencdies not imported
8080
command: |
8181
. venv/bin/activate
82-
pytest -x test_init/test_dependencies_not_imported.py
82+
python -m pytest -x test_init/test_dependencies_not_imported.py
8383
- run:
8484
name: Test lazy imports
8585
command: |
8686
. venv/bin/activate
87-
pytest -x test_init/test_lazy_imports.py
87+
python -m pytest -x test_init/test_lazy_imports.py
8888
test_orca:
8989
parameters:
9090
py:

requires-optional.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ numpy
2020
# matplotlib==2.2.2
2121

2222
## testing dependencies ##
23+
# see also test_requirements/*.txt for specific Python versions
2324
coverage==4.3.1
2425
mock==2.0.0
2526
pytest==8.1.1
2627
xarray
2728
pytz
2829

29-
## orca dependencies ##
30-
requests
31-
psutil
32-
3330
## code formatting ##
3431
pre-commit
3532
black==22.3.0

test_requirements/requirements_311_optional.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ pyshp==2.1.3
1616
matplotlib==3.8.0
1717
scikit-image==0.22.0
1818
psutil==5.7.0
19-
kaleido
2019
orjson==3.8.12
21-
polars[timezone]
22-
pyarrow
2320
narwhals>=1.15.1
2421
anywidget==0.9.13
22+
polars[timezone]
23+
pyarrow
24+
kaleido
25+
plotly-geo

test_requirements/requirements_312_optional.txt

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ pyarrow
2323
narwhals>=1.15.1
2424
anywidget==0.9.13
2525
jupyter-console==6.4.4
26+
plotly-geo

tests/test_core/test_subplots/test_make_subplots.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -1954,10 +1954,10 @@ def test_make_subplots_spacing_error():
19541954
# vertical_spacing is raised when spacing exceeds that value
19551955
for match in [
19561956
(
1957-
"^%s spacing cannot be greater than \(1 / \(%s - 1\)\) = %f."
1957+
r"^%s spacing cannot be greater than \(1 / \(%s - 1\)\) = %f."
19581958
% ("Vertical", "rows", 1.0 / 50.0)
1959-
).replace(".", "\."),
1960-
"The resulting plot would have 51 rows \(rows=51\)\.$",
1959+
).replace(".", r"\."),
1960+
r"The resulting plot would have 51 rows \(rows=51\)\.$",
19611961
]:
19621962
with pytest.raises(
19631963
ValueError,
@@ -1966,10 +1966,10 @@ def test_make_subplots_spacing_error():
19661966
fig = subplots.make_subplots(51, 1, vertical_spacing=0.0201)
19671967
for match in [
19681968
(
1969-
"^%s spacing cannot be greater than \(1 / \(%s - 1\)\) = %f."
1969+
r"^%s spacing cannot be greater than \(1 / \(%s - 1\)\) = %f."
19701970
% ("Horizontal", "cols", 1.0 / 50.0)
1971-
).replace(".", "\."),
1972-
"The resulting plot would have 51 columns \(cols=51\)\.$",
1971+
).replace(".", r"\."),
1972+
r"The resulting plot would have 51 columns \(cols=51\)\.$",
19731973
]:
19741974
with pytest.raises(
19751975
ValueError,
@@ -2011,18 +2011,18 @@ def test_make_subplots_spacing_error():
20112011
# This shouldn't happen so we assert False to force failure
20122012
assert False
20132013
with pytest.raises(
2014-
ValueError, match="^Horizontal spacing must be between 0 and 1\.$"
2014+
ValueError, match=r"^Horizontal spacing must be between 0 and 1\.$"
20152015
):
20162016
fig = subplots.make_subplots(1, 1, horizontal_spacing=-0.01)
20172017
with pytest.raises(
2018-
ValueError, match="^Horizontal spacing must be between 0 and 1\.$"
2018+
ValueError, match=r"^Horizontal spacing must be between 0 and 1\.$"
20192019
):
20202020
fig = subplots.make_subplots(1, 1, horizontal_spacing=1.01)
20212021
with pytest.raises(
2022-
ValueError, match="^Vertical spacing must be between 0 and 1\.$"
2022+
ValueError, match=r"^Vertical spacing must be between 0 and 1\.$"
20232023
):
20242024
fig = subplots.make_subplots(1, 1, vertical_spacing=-0.01)
20252025
with pytest.raises(
2026-
ValueError, match="^Vertical spacing must be between 0 and 1\.$"
2026+
ValueError, match=r"^Vertical spacing must be between 0 and 1\.$"
20272027
):
20282028
fig = subplots.make_subplots(1, 1, vertical_spacing=1.01)

tests/test_io/test_to_from_plotly_json.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def test_sanitize_json(engine):
244244
fig = go.Figure(layout=layout)
245245
fig_json = pio.to_json_plotly(fig, engine=engine)
246246
layout_2 = json.loads(fig_json)["layout"]
247-
del layout_2["template"]
247+
if "template" in layout_2:
248+
del layout_2["template"]
248249

249250
assert layout == layout_2
250251

tests/test_optional/test_graph_objs/test_skipped_b64_keys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_np_layers(self):
6666
"center": {"lon": 0.5, "lat": 51},
6767
},
6868
}
69-
data = [{"type": "scattermapbox"}]
69+
data = [{"type": "scattermap"}]
7070

7171
fig = go.Figure(data=data, layout=layout)
7272

tests/test_optional/test_px/test_px_hover.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_sunburst_hoverdict_color(backend):
186186

187187
def test_date_in_hover(constructor):
188188
df = nw.from_native(
189-
constructor({"date": ["2015-04-04 19:31:30+01:00"], "value": [3]})
189+
constructor({"date": ["2015-04-04 19:31:30+0100"], "value": [3]})
190190
).with_columns(date=nw.col("date").str.to_datetime(format="%Y-%m-%d %H:%M:%S%z"))
191191
fig = px.scatter(df.to_native(), x="value", y="value", hover_data=["date"])
192192

tests/test_optional/test_px/test_px_input.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@
88
from packaging import version
99
import unittest.mock as mock
1010
from plotly.express._core import build_dataframe
11+
from plotly import optional_imports
1112
from pandas.testing import assert_frame_equal
1213
import sys
1314
import warnings
1415

1516

17+
# FIXME: don't test with vaex if vaex isn't installed
18+
if (optional_imports.get_module("vaex") is None) and (sys.version_info >= (3, 12)):
19+
TEST_LIBS = ["polars"]
20+
else:
21+
TEST_LIBS = ["vaex", "polars"]
22+
23+
1624
def test_numpy():
1725
fig = px.scatter(x=[1, 2, 3], y=[2, 3, 4], color=[1, 3, 9])
1826
assert np.all(fig.data[0].x == np.array([1, 2, 3]))
@@ -342,7 +350,7 @@ def __dataframe__(self, allow_copy: bool = True):
342350
or sys.version_info >= (3, 12),
343351
reason="plotly doesn't use a dataframe interchange protocol for pandas < 2.0.2",
344352
)
345-
@pytest.mark.parametrize("test_lib", ["vaex", "polars"])
353+
@pytest.mark.parametrize("test_lib", TEST_LIBS)
346354
def test_build_df_from_vaex_and_polars(test_lib):
347355
if test_lib == "vaex":
348356
import vaex as lib
@@ -365,7 +373,7 @@ def test_build_df_from_vaex_and_polars(test_lib):
365373
or sys.version_info >= (3, 12),
366374
reason="plotly doesn't use a dataframe interchange protocol for pandas < 2.0.2",
367375
)
368-
@pytest.mark.parametrize("test_lib", ["vaex", "polars"])
376+
@pytest.mark.parametrize("test_lib", TEST_LIBS)
369377
@pytest.mark.parametrize(
370378
"hover_data", [["sepal_width"], {"sepal_length": False, "sepal_width": ":.2f"}]
371379
)
@@ -393,7 +401,7 @@ def test_build_df_with_hover_data_from_vaex_and_polars(test_lib, hover_data):
393401

394402
def test_timezones(constructor):
395403
df = nw.from_native(
396-
constructor({"date": ["2015-04-04 19:31:30+01:00"], "value": [3]})
404+
constructor({"date": ["2015-04-04 19:31:30+0100"], "value": [3]})
397405
).with_columns(nw.col("date").str.to_datetime(format="%Y-%m-%d %H:%M:%S%z"))
398406
args = dict(data_frame=df.to_native(), x="date", y="value")
399407
out = build_dataframe(args, go.Scatter)

tests/test_orca/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)