File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
distributed/shuffle/tests Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ from pickle import PickleBuffer
4
+
3
5
import pytest
4
6
5
7
from distributed .shuffle ._core import _mean_shard_size
@@ -12,7 +14,17 @@ def test_mean_shard_size():
12
14
# Don't fully iterate over large collections
13
15
assert _mean_shard_size ([b"12" * n for n in range (1000 )]) == 9
14
16
# 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
+ )
16
28
# Recursion into lists or tuples; ignore int
17
29
assert _mean_shard_size ([(1 , 2 , [3 , b"123456" ])]) == 6
18
30
# Don't blindly call sizeof() on unexpected objects
You can’t perform that action at this time.
0 commit comments