From cf9b883549d06fb033657b7ce51a548c86041062 Mon Sep 17 00:00:00 2001 From: Callum Dickinson <2997843+Callum027@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:31:29 +1300 Subject: [PATCH] Fix running functional tests with NumPy 2.2 `testcase` performs an `if not` check on annotations passed in asserts. From NumPy 2.2 this raises an exception about ambiguous falseyness [1], so convert the array to a string when passing it as an annotation to get around this. [1]: https://numpy.org/devdocs/release/2.2.0-notes.html#expired-deprecations --- gnocchi/tests/test_carbonara.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnocchi/tests/test_carbonara.py b/gnocchi/tests/test_carbonara.py index f50b56fcb..110ba7627 100644 --- a/gnocchi/tests/test_carbonara.py +++ b/gnocchi/tests/test_carbonara.py @@ -316,7 +316,7 @@ def test_aggregation_std_with_unique(self): ts = carbonara.TimeSerie.from_data( [datetime64(2014, 1, 1, 12, 0, 0)], [3]) ts = self._resample(ts, numpy.timedelta64(60, 's'), 'std') - self.assertEqual(0, len(ts), ts.values) + self.assertEqual(0, len(ts), str(ts.values)) ts = carbonara.TimeSerie.from_data( [datetime64(2014, 1, 1, 12, 0, 0),