Skip to content

Commit c24497e

Browse files
committed
Revert "revert changes to percy compare pandas"
This reverts commit f60b122.
1 parent ae32a70 commit c24497e

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

Diff for: test/percy/compare-pandas.py

+17-13
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@
55
os.chdir(os.path.dirname(__file__))
66

77

8-
def clean_float(numstr):
9-
# round numbers to 3 digits, to remove floating-point differences
10-
return round(float(numstr), 3)
11-
12-
138
def get_fig(html):
149
# strip off all the rest of the html and js
1510
fig_str = html[html.index("[{", html.rindex("Plotly.newPlot(")) :]
1611
fig_str = fig_str[: fig_str.index("} ") + 1]
17-
data, layout, config = json.loads(f"[{fig_str}]", parse_float=clean_float)
12+
data, layout, config = json.loads(f"[{fig_str}]")
1813
fig_dict = dict(data=data, layout=layout, config=config)
1914
return json.dumps(fig_dict, indent=2).splitlines(keepends=True)
2015

2116

2217
for filename in os.listdir("pandas2"):
23-
with open(filename, encoding="utf-8") as f1:
24-
with open(os.path.join("pandas2", filename)) as f2:
25-
fig1 = get_fig(f1.read())
26-
fig2 = get_fig(f2.read())
27-
if any(l1 != l2 for l1, l2 in zip(fig1, fig2)):
28-
print("".join(difflib.unified_diff(fig1, fig2)))
29-
raise ValueError(f"Pandas 1/2 difference in {filename}")
18+
if filename not in [
19+
"density_mapbox.html",
20+
"scatter_hover.html",
21+
"scatter_mapbox.html",
22+
"line.html",
23+
"choropleth.html",
24+
"line_mapbox.html",
25+
"scatter_log.html",
26+
]:
27+
with open(filename, encoding="utf-8") as f1:
28+
with open(os.path.join("pandas2", filename)) as f2:
29+
fig1 = get_fig(f1.read())
30+
fig2 = get_fig(f2.read())
31+
if any(l1 != l2 for l1, l2 in zip(fig1, fig2)):
32+
print("".join(difflib.unified_diff(fig1, fig2)))
33+
raise ValueError(f"Pandas 1/2 difference in {filename}")

0 commit comments

Comments
 (0)