Skip to content

Commit

Permalink
assert on deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Jul 16, 2024
1 parent fc39280 commit a04a25f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,20 @@ async def test_map_retries(c, s, a, b):

@gen_cluster(client=True)
async def test_map_batch_size(c, s, a, b):
result = c.map(inc, range(100), batch_size=10)
with pytest.deprecated_call(match="batch_size"):
result = c.map(inc, range(100), batch_size=10)
result = await c.gather(result)
assert result == list(range(1, 101))

result = c.map(add, range(100), range(100), batch_size=10)
with pytest.deprecated_call(match="batch_size"):
result = c.map(add, range(100), range(100), batch_size=10)
result = await c.gather(result)
assert result == list(range(0, 200, 2))

# mismatch shape
result = c.map(add, range(100, 200), range(10), batch_size=2)

with pytest.deprecated_call(match="batch_size"):
result = c.map(add, range(100, 200), range(10), batch_size=2)
result = await c.gather(result)
assert result == list(range(100, 120, 2))

Expand All @@ -261,12 +265,13 @@ async def test_map_batch_size(c, s, a, b):
async def test_custom_key_with_batches(c, s, a, b):
"""Test of <https://github.com/dask/distributed/issues/4588>"""

futs = c.map(
lambda x: x**2,
range(10),
batch_size=5,
key=[str(x) for x in range(10)],
)
with pytest.deprecated_call(match="batch_size"):
futs = c.map(
lambda x: x**2,
range(10),
batch_size=5,
key=[str(x) for x in range(10)],
)
assert len(futs) == 10
await wait(futs)

Expand Down

0 comments on commit a04a25f

Please sign in to comment.