From fb5876f8a08b9ac50e12fe717d79b3c13a76e944 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Mon, 4 Jan 2021 09:41:39 +0100 Subject: [PATCH] tests: assert bounds within reasonable machine precision (#1432) --- tests/plugins/test_heat_map.py | 6 ++++-- tests/plugins/test_marker_cluster.py | 6 ++++-- tests/test_folium.py | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/plugins/test_heat_map.py b/tests/plugins/test_heat_map.py index cdf618682..0e099efb5 100644 --- a/tests/plugins/test_heat_map.py +++ b/tests/plugins/test_heat_map.py @@ -48,8 +48,10 @@ def test_heat_map(): assert tmpl.render(this=hm) bounds = m.get_bounds() - assert bounds == [[46.218566840847025, 3.0302801394447734], - [50.75345011431167, 7.132453997672826]], bounds + np.testing.assert_allclose( + bounds, + [[46.218566840847025, 3.0302801394447734], + [50.75345011431167, 7.132453997672826]]) def test_heatmap_data(): diff --git a/tests/plugins/test_marker_cluster.py b/tests/plugins/test_marker_cluster.py index ea5cc2923..631cf11d6 100644 --- a/tests/plugins/test_marker_cluster.py +++ b/tests/plugins/test_marker_cluster.py @@ -53,5 +53,7 @@ def test_marker_cluster(): assert expected in out bounds = m.get_bounds() - assert bounds == [[35.147332572663785, -11.520684337300109], - [59.839718052359274, 29.94931046497927]], bounds + np.testing.assert_allclose( + bounds, + [[35.147332572663785, -11.520684337300109], + [59.839718052359274, 29.94931046497927]]) diff --git a/tests/test_folium.py b/tests/test_folium.py index a101303de..14823748f 100644 --- a/tests/test_folium.py +++ b/tests/test_folium.py @@ -364,4 +364,6 @@ def test_json_request(self): self.m._parent.render() bounds = self.m.get_bounds() - assert bounds == [[18.948267, -178.123152], [71.351633, 173.304726]], bounds # noqa + np.testing.assert_allclose( + bounds, + [[18.948267, -178.123152], [71.351633, 173.304726]])