Don't fail plot tests on rounding error
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Mon, 21 Oct 2024 18:43:11 +0000 (19:43 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Mon, 21 Oct 2024 18:43:11 +0000 (19:43 +0100)
(upstream seem to have _disabled_ the affected tests
...see also test_series)

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/1029251
Forwarded: no

Gbp-Pq: Name 1029251_ignore_rounding_error.patch

pandas/tests/plotting/frame/test_frame_subplots.py

index 4d8d8fa4cdee38d568d099019e89114fb0cdb4e9..46b9cea2ff74a077b2e6ba3b34bc90c6a908843b 100644 (file)
@@ -3,6 +3,7 @@
 import string
 
 import numpy as np
+from numpy.testing import assert_array_almost_equal_nulp
 import pytest
 
 from pandas.compat import is_platform_linux
@@ -435,7 +436,7 @@ class TestDataFramePlotsSubplots:
         # no subplots
         df = DataFrame({"A": [3] * 5, "B": list(range(1, 6))}, index=range(5))
         ax = df.plot.bar(grid=True, log=True)
-        tm.assert_numpy_array_equal(ax.yaxis.get_ticklocs(), expected)
+        assert_array_almost_equal_nulp(ax.yaxis.get_ticklocs(), expected, 4)
 
     @pytest.mark.xfail(
         np_version_gte1p24 and is_platform_linux(),
@@ -449,8 +450,8 @@ class TestDataFramePlotsSubplots:
             log=True, subplots=True
         )
 
-        tm.assert_numpy_array_equal(ax[0].yaxis.get_ticklocs(), expected)
-        tm.assert_numpy_array_equal(ax[1].yaxis.get_ticklocs(), expected)
+        assert_array_almost_equal_nulp(ax[0].yaxis.get_ticklocs(), expected, 4)
+        assert_array_almost_equal_nulp(ax[1].yaxis.get_ticklocs(), expected, 4)
 
     def test_boxplot_subplots_return_type_default(self, hist_df):
         df = hist_df