From f9304c92721c774dbb424ca7002b36ad8d48a114 Mon Sep 17 00:00:00 2001 From: Topher Cawlfield <4094385+tcawlfield@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:28:36 -0600 Subject: [PATCH] Fixing missed changes with ak.array_equal * Now overrides numpy.array_equal * Adding link to toctree * Unit test checks numpy override --- docs/reference/toctree.txt | 3 ++- src/awkward/operations/ak_array_equal.py | 1 + tests/test_1105_ak_aray_equal.py | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reference/toctree.txt b/docs/reference/toctree.txt index 126e0a2b9c..4b6ae1154d 100644 --- a/docs/reference/toctree.txt +++ b/docs/reference/toctree.txt @@ -299,11 +299,12 @@ generated/ak.backend .. toctree:: - :caption: Approximation + :caption: Approximation and comparison generated/ak.round generated/ak.isclose generated/ak.almost_equal + generated/ak.array_equal .. toctree:: :caption: NumPy compatibility diff --git a/src/awkward/operations/ak_array_equal.py b/src/awkward/operations/ak_array_equal.py index 2a7221baab..398db6b2a6 100644 --- a/src/awkward/operations/ak_array_equal.py +++ b/src/awkward/operations/ak_array_equal.py @@ -8,6 +8,7 @@ __all__ = ("array_equal",) +@ak._connect.numpy.implements("array_equal") @high_level_function() def array_equal( a1, diff --git a/tests/test_1105_ak_aray_equal.py b/tests/test_1105_ak_aray_equal.py index 519d0039c5..7512f50316 100644 --- a/tests/test_1105_ak_aray_equal.py +++ b/tests/test_1105_ak_aray_equal.py @@ -88,3 +88,10 @@ def test_array_equal_with_params(): ) assert not ak.array_equal(a1, a2) assert ak.array_equal(a1, a2, check_parameters=False) + + +def test_array_equal_numpy_override(): + assert np.array_equal( + ak.Array([[1, 2], [], [3, 4, 5]]), + ak.Array([[1, 2], [], [3, 4, 5]]), + )