Skip to content

Commit 63d40e3

Browse files
test map(..., strict=True)
1 parent ec9dfb5 commit 63d40e3

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

unittests/test_builtins.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ async def map_op(value: int) -> int:
121121
)
122122

123123

124+
@pytest.mark.parametrize(
125+
"itrs",
126+
[
127+
(range(4), range(5), range(5)),
128+
(range(5), range(4), range(5)),
129+
(range(5), range(5), range(4)),
130+
],
131+
)
132+
@sync
133+
async def test_map_strict_unequal(itrs: "tuple[range, ...]"):
134+
def triple_sum(x: int, y: int, z: int) -> int:
135+
return x + y + z
136+
# no error without strict
137+
async for _ in a.map(triple_sum, *itrs):
138+
pass
139+
# error with strict
140+
with pytest.raises(ValueError):
141+
async for _ in a.map(triple_sum, *itrs, strict=True):
142+
pass
143+
144+
124145
@sync
125146
async def test_map_aa():
126147
async def map_op(value: int) -> int:

0 commit comments

Comments
 (0)