Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 19b611d

Browse files
Merge pull request #4977 from plotly/updates-to-tests
fix: cleaning up tests for release
2 parents 86a7e12 + 742f592 commit 19b611d

File tree

22 files changed

+42
-11321
lines changed

22 files changed

+42
-11321
lines changed

‎.circleci/config.yml‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ commands:
2424
name: Test core
2525
command: |
2626
. venv/bin/activate
27-
pytest plotly/tests/test_core
27+
python -m pytest plotly/tests/test_core
2828
no_output_timeout: 20m
2929

3030
test_optional:
@@ -55,36 +55,36 @@ commands:
5555
name: Test core
5656
command: |
5757
. venv/bin/activate
58-
pytest plotly/tests/test_core
58+
python -m pytest plotly/tests/test_core
5959
no_output_timeout: 20m
6060
- run:
6161
name: Test optional
6262
command: |
6363
. venv/bin/activate
64-
pytest plotly/tests/test_optional
64+
python -m pytest plotly/tests/test_optional
6565
no_output_timeout: 40m
6666
- run:
6767
name: Test utils
6868
command: |
6969
. venv/bin/activate
70-
pytest _plotly_utils/tests/
70+
python -m pytest _plotly_utils/tests/
7171
no_output_timeout: 20m
7272
- run:
7373
name: Test io
7474
command: |
7575
. venv/bin/activate
76-
pytest plotly/tests/test_io
76+
python -m pytest plotly/tests/test_io
7777
no_output_timeout: 20m
7878
- run:
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:
@@ -118,7 +118,7 @@ commands:
118118
name: Test orca
119119
command: |
120120
. venv/bin/activate
121-
pytest plotly/tests/test_orca
121+
python -m pytest plotly/tests/test_orca
122122
no_output_timeout: 20m
123123
- store_artifacts:
124124
path: plotly/tests/test_orca/images/linux/failed
@@ -329,7 +329,7 @@ jobs:
329329
command: |
330330
. venv/bin/activate
331331
locale
332-
pytest -k 'not nodev' plotly/tests/test_core
332+
python -m pytest -k 'not nodev' plotly/tests/test_core
333333
no_output_timeout: 20m
334334
- run:
335335
name: Commit

‎_plotly_utils/tests/validators/test_enumerated_validator.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def validator():
1414

1515
@pytest.fixture()
1616
def validator_re():
17-
values = ["foo", "/bar(\d)+/", "baz"]
17+
values = ["foo", r"/bar(\d)+/", "baz"]
1818
return EnumeratedValidator("prop", "parent", values, array_ok=False)
1919

2020

@@ -26,7 +26,7 @@ def validator_aok():
2626

2727
@pytest.fixture()
2828
def validator_aok_re():
29-
values = ["foo", "/bar(\d)+/", "baz"]
29+
values = ["foo", r"/bar(\d)+/", "baz"]
3030
return EnumeratedValidator("prop", "parent", values, array_ok=True)
3131

3232

‎plotly/tests/test_core/test_subplots/test_make_subplots.py‎

Lines changed: 10 additions & 10 deletions
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)

‎plotly/tests/test_io/test_to_from_plotly_json.py‎

Lines changed: 2 additions & 1 deletion
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

‎plotly/tests/test_optional/test_graph_objs/test_skipped_b64_keys.py‎

Lines changed: 1 addition & 1 deletion
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

‎plotly/tests/test_optional/test_px/test_px_hover.py‎

Lines changed: 1 addition & 1 deletion
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

‎plotly/tests/test_optional/test_px/test_px_input.py‎

Lines changed: 11 additions & 3 deletions
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)

‎plotly/tests/test_orca/__init__.py‎

Whitespace-only changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /