-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathtest_scatter.py
52 lines (43 loc) · 1.53 KB
/
test_scatter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pytest
from plotly import optional_imports
from plotly.tests.utils import compare_dict, strip_dict_params
from plotly.tests.test_optional.optional_utils import run_fig
from plotly.tests.test_optional.test_matplotlylib.data.scatter import *
matplotlylib = optional_imports.get_module("plotly.matplotlylib")
if matplotlylib:
import matplotlib.pyplot as plt
@pytest.mark.skip
def test_simple_scatter():
fig, ax = plt.subplots()
ax.scatter(D["x1"], D["y1"])
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
d1, d2 = strip_dict_params(
data_dict, SIMPLE_SCATTER["data"][data_no], ignore=["uid"]
)
print(d1)
print("\n")
print(d2)
assert d1 == d2
equivalent, msg = compare_dict(
renderer.plotly_fig["layout"], SIMPLE_SCATTER["layout"]
)
assert equivalent, msg
@pytest.mark.skip
def test_double_scatter():
fig, ax = plt.subplots()
ax.scatter(D["x1"], D["y1"], color="red", s=121, marker="^", alpha=0.5)
ax.scatter(D["x2"], D["y2"], color="purple", s=64, marker="s", alpha=0.5)
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig["data"]):
d1, d2 = strip_dict_params(
data_dict, DOUBLE_SCATTER["data"][data_no], ignore=["uid"]
)
print(d1)
print("\n")
print(d2)
assert d1 == d2
equivalent, msg = compare_dict(
renderer.plotly_fig["layout"], DOUBLE_SCATTER["layout"]
)
assert equivalent, msg