Skip to content

Commit 4643e1f

Browse files
alexfiklinducer
authored andcommitted
tests: use Optional and Tuple to test decorator
1 parent bc7139f commit 4643e1f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

arraycontext/impl/pytato/fake_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,6 @@ def absolute(self, a):
240240
return self.abs(a)
241241

242242
def vdot(self, a: Array, b: Array):
243-
244243
return rec_multimap_array_container(pt.vdot, a, b)
244+
245245
# }}}

test/test_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
THE SOFTWARE.
2828
"""
2929
import logging
30-
from typing import cast
30+
from typing import Optional, Tuple, cast # noqa: UP035
3131

3232
import numpy as np
3333
import pytest
@@ -63,7 +63,7 @@ def test_dataclass_array_container() -> None:
6363
class ArrayContainerWithOptional:
6464
x: np.ndarray
6565
# Deliberately left as Optional to test compatibility.
66-
y: np.ndarray | None
66+
y: Optional[np.ndarray] # noqa: UP045
6767

6868
with pytest.raises(TypeError, match="Field 'y' union contains non-array"):
6969
# NOTE: cannot have wrapped annotations (here by `Optional`)
@@ -76,7 +76,8 @@ class ArrayContainerWithOptional:
7676
@dataclass
7777
class ArrayContainerWithTuple:
7878
x: Array
79-
y: tuple[Array, Array]
79+
# Deliberately left as Tuple to test compatibility.
80+
y: Tuple[Array, Array] # noqa: UP006
8081

8182
with pytest.raises(TypeError, match="Typing annotation not supported on field 'y'"):
8283
dataclass_array_container(ArrayContainerWithTuple)

0 commit comments

Comments
 (0)