From c24497ecea3c65cf2f99e7a652cfbedae9d8711d Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Mon, 21 Oct 2024 20:03:52 -0400 Subject: [PATCH 1/2] Revert "revert changes to percy compare pandas" This reverts commit f60b122dbc1defdb439287997586a15e75e84073. --- test/percy/compare-pandas.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/test/percy/compare-pandas.py b/test/percy/compare-pandas.py index ded4e16ffef..8cbb2301029 100644 --- a/test/percy/compare-pandas.py +++ b/test/percy/compare-pandas.py @@ -5,25 +5,29 @@ os.chdir(os.path.dirname(__file__)) -def clean_float(numstr): - # round numbers to 3 digits, to remove floating-point differences - return round(float(numstr), 3) - - def get_fig(html): # strip off all the rest of the html and js fig_str = html[html.index("[{", html.rindex("Plotly.newPlot(")) :] fig_str = fig_str[: fig_str.index("} ") + 1] - data, layout, config = json.loads(f"[{fig_str}]", parse_float=clean_float) + data, layout, config = json.loads(f"[{fig_str}]") fig_dict = dict(data=data, layout=layout, config=config) return json.dumps(fig_dict, indent=2).splitlines(keepends=True) for filename in os.listdir("pandas2"): - with open(filename, encoding="utf-8") as f1: - with open(os.path.join("pandas2", filename)) as f2: - fig1 = get_fig(f1.read()) - fig2 = get_fig(f2.read()) - if any(l1 != l2 for l1, l2 in zip(fig1, fig2)): - print("".join(difflib.unified_diff(fig1, fig2))) - raise ValueError(f"Pandas 1/2 difference in {filename}") + if filename not in [ + "density_mapbox.html", + "scatter_hover.html", + "scatter_mapbox.html", + "line.html", + "choropleth.html", + "line_mapbox.html", + "scatter_log.html", + ]: + with open(filename, encoding="utf-8") as f1: + with open(os.path.join("pandas2", filename)) as f2: + fig1 = get_fig(f1.read()) + fig2 = get_fig(f2.read()) + if any(l1 != l2 for l1, l2 in zip(fig1, fig2)): + print("".join(difflib.unified_diff(fig1, fig2))) + raise ValueError(f"Pandas 1/2 difference in {filename}") From 5aedd518e64dd07eb889c7e236e7933ed652c21b Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Mon, 21 Oct 2024 20:22:40 -0400 Subject: [PATCH 2/2] skip maps as well as mapbox --- test/percy/compare-pandas.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/percy/compare-pandas.py b/test/percy/compare-pandas.py index 8cbb2301029..44a2d3c7971 100644 --- a/test/percy/compare-pandas.py +++ b/test/percy/compare-pandas.py @@ -17,11 +17,14 @@ def get_fig(html): for filename in os.listdir("pandas2"): if filename not in [ "density_mapbox.html", + "density_map.html", "scatter_hover.html", "scatter_mapbox.html", + "scatter_map.html", "line.html", "choropleth.html", "line_mapbox.html", + "line_map.html", "scatter_log.html", ]: with open(filename, encoding="utf-8") as f1: