From 5b129a08505a98b4c8c011914cd4fc67697e7de5 Mon Sep 17 00:00:00 2001 From: jirka <6035284+Borda@users.noreply.github.com> Date: Thu, 5 Feb 2026 23:06:53 +0900 Subject: [PATCH] Ensure compatibility with Python 3.9 --- test/metrics/test_detection.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/test/metrics/test_detection.py b/test/metrics/test_detection.py index f5be7ac6..a61db58b 100644 --- a/test/metrics/test_detection.py +++ b/test/metrics/test_detection.py @@ -417,31 +417,27 @@ def test_drop_extra_matches( @pytest.mark.parametrize( - "recall, precision, expected_result, exception", + "recall, precision, expected_result", [ ( np.array([1.0]), np.array([1.0]), 1.0, - DoesNotRaise(), ), # perfect recall and precision ( np.array([0.0]), np.array([0.0]), 0.0, - DoesNotRaise(), ), # no recall and precision ( np.array([0.0, 0.2, 0.2, 0.8, 0.8, 1.0]), np.array([0.7, 0.8, 0.4, 0.5, 0.1, 0.2]), 0.5, - DoesNotRaise(), ), ( np.array([0.0, 0.5, 0.5, 1.0]), np.array([0.75, 0.75, 0.75, 0.75]), 0.75, - DoesNotRaise(), ), ], ) @@ -449,10 +445,10 @@ def test_compute_average_precision( recall: np.ndarray, precision: np.ndarray, expected_result: float, - exception: Exception, ) -> None: - with exception: - result = MeanAveragePrecision.compute_average_precision( + with DoesNotRaise(): + # FIX: Use .__func__ to support Python 3.9 + result = MeanAveragePrecision.compute_average_precision.__func__( recall=recall, precision=precision ) - assert_almost_equal(result, expected_result, tolerance=0.01) + assert_almost_equal(result, expected_result, tolerance=0.01)