8000 Silence NonInteractiveExampleWarning in test_unary · adityagoel4512/array-api-tests@bc997e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc997e4

Browse files
committed
Silence NonInteractiveExampleWarning in test_unary
1 parent d7bfe73 commit bc997e4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

array_api_tests/test_special_cases.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
from decimal import ROUND_HALF_EVEN, Decimal
2121
from enum import Enum, auto
2222
from typing import Any, Callable, Dict, List, Optional, Protocol, Tuple, Literal
23-
from warnings import warn
23+
from warnings import warn, filterwarnings, catch_warnings
2424

2525
import pytest
2626
from hypothesis import given, note, settings, assume
2727
from hypothesis import strategies as st
28+
from hypothesis.errors import NonInteractiveExampleWarning
2829

2930
from array_api_tests.typing import Array, DataType
3031

@@ -1250,7 +1251,9 @@ def parse_binary_case_block(case_block: str, func_name: str) -> List[BinaryCase]
12501251

12511252
@pytest.mark.parametrize("func_name, func, case", unary_params)
12521253
def test_unary(func_name, func, case):
1253-
in_value = case.cond_from_dtype(xp.float64).example()
1254+
with catch_warnings():
1255+
filterwarnings('ignore', category=NonInteractiveExampleWarning)
1256+
in_value = case.cond_from_dtype(xp.float64).example()
12541257
x = xp.asarray(in_value, dtype=xp.float64)
12551258
out = func(x)
12561259
out_value = float(out)

0 commit comments

Comments
 (0)
0