Skip to content

Commit 810dca9

Browse files
committed
black compare-pandas
1 parent 9c04542 commit 810dca9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44

55
os.chdir(os.path.dirname(__file__))
66

7+
78
def clean_float(numstr):
89
# round numbers to 3 digits, to remove floating-point differences
910
return round(float(numstr), 3)
1011

12+
1113
def get_fig(html):
1214
# strip off all the rest of the html and js
13-
fig_str = html[html.index('[{', html.rindex('Plotly.newPlot(')):]
14-
fig_str = fig_str[:fig_str.index('} ') + 1]
15-
data, layout, config = json.loads(f'[{fig_str}]', parse_float=clean_float)
15+
fig_str = html[html.index("[{", html.rindex("Plotly.newPlot(")) :]
16+
fig_str = fig_str[: fig_str.index("} ") + 1]
17+
data, layout, config = json.loads(f"[{fig_str}]", parse_float=clean_float)
1618
fig_dict = dict(data=data, layout=layout, config=config)
1719
return json.dumps(fig_dict, indent=2).splitlines(keepends=True)
1820

21+
1922
for filename in os.listdir("pandas2"):
2023
with open(filename, encoding="utf-8") as f1:
2124
with open(os.path.join("pandas2", filename)) as f2:
2225
fig1 = get_fig(f1.read())
2326
fig2 = get_fig(f2.read())
2427
if any(l1 != l2 for l1, l2 in zip(fig1, fig2)):
25-
print(''.join(difflib.unified_diff(fig1, fig2)))
28+
print("".join(difflib.unified_diff(fig1, fig2)))
2629
raise ValueError(f"Pandas 1/2 difference in {filename}")

0 commit comments

Comments
 (0)