Skip to content

Commit df1f990

Browse files
Copilotev-br
andcommitted
Fix complex value parsing to handle spaces in backticked values
Co-authored-by: ev-br <2133832+ev-br@users.noreply.github.com>
1 parent 85a7670 commit df1f990

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

array_api_tests/test_special_cases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,10 @@ def parse_complex_result(result_str: str) -> Tuple[Callable[[complex], bool], st
596596
unspecified_real_sign = "sign of the real component is unspecified" in result_str
597597
unspecified_imag_sign = "sign of the imaginary component is unspecified" in result_str
598598

599-
# Extract the complex value from backticks
600-
if m := r_code.match(result_str):
599+
# Extract the complex value from backticks - need to handle spaces in complex values
600+
# Pattern: ``...`` where ... can contain spaces (for complex values like "0 + NaN j")
601+
m = re.search(r"``([^`]+)``", result_str)
602+
if m:
601603
value_str = m.group(1)
602604
try:
603605
expected = parse_complex_value(value_str)

0 commit comments

Comments
 (0)