Skip to content

Commit f130fbc

Browse files
committed
test _merge_shard_size on picklebuffer
1 parent 2b97ada commit f130fbc

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

distributed/shuffle/tests/test_core.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from pickle import PickleBuffer
4+
35
import pytest
46

57
from distributed.shuffle._core import _mean_shard_size
@@ -12,7 +14,17 @@ def test_mean_shard_size():
1214
# Don't fully iterate over large collections
1315
assert _mean_shard_size([b"12" * n for n in range(1000)]) == 9
1416
# Support any Buffer object
15-
assert _mean_shard_size([b"12", bytearray(b"1234"), memoryview(b"123456")]) == 4
17+
assert (
18+
_mean_shard_size(
19+
[
20+
b"12",
21+
bytearray(b"1234"),
22+
memoryview(b"123456"),
23+
PickleBuffer(b"12345678"),
24+
]
25+
)
26+
== 5
27+
)
1628
# Recursion into lists or tuples; ignore int
1729
assert _mean_shard_size([(1, 2, [3, b"123456"])]) == 6
1830
# Don't blindly call sizeof() on unexpected objects

0 commit comments

Comments
 (0)