From 27cdabdf9f2ee0dce5e5badb73ed4335da3df403 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sun, 8 Feb 2026 20:12:51 +0100 Subject: [PATCH] BUG: fix the regex to parse the dtype category from the docstring This was make a bunch of test_signature tests fail / be xfailed. The core of the change is that the regex was looking for `x1: array` while from 2024.12 the text was `x1: Union[array | int]` etc. --- array_api_tests/dtype_helpers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/array_api_tests/dtype_helpers.py b/array_api_tests/dtype_helpers.py index 2fe3c1b2..cca3643e 100644 --- a/array_api_tests/dtype_helpers.py +++ b/array_api_tests/dtype_helpers.py @@ -447,7 +447,14 @@ def result_type(*dtypes: DataType): r_alias = re.compile("[aA]lias") -r_in_dtypes = re.compile("x1?: array\n.+have an? (.+) data type.") + +r_in_dtypes = re.compile( + r'(?:x(?:1)?: (?:Union\[)?array(?:, (?:int|float|complex|bool))*(?:\])?\s*\n.+?' + r'(?:x2: (?:Union\[)?array(?:, (?:int|float|complex|bool))*(?:\])?\s*\n.+?)?)?' + r'Should have an? (boolean|integer or boolean|real-valued floating-point|complex floating-point|real-valued|floating-point|integer|numeric) data type\.', + re.DOTALL +) + r_int_note = re.compile( "If one or both of the input arrays have integer data types, " "the result is implementation-dependent"