code: def test_mean_shard_size():
      assert _mean_shard_size([]) == 0
      assert _mean_shard_size([b""]) == 0
      assert _mean_shard_size([b"123", b"45678"]) == 4
      # Don't fully iterate over large collections
      assert _mean_shard_size([b"12" * n for n in range(1000)]) == 9
      # Support any Buffer object
      assert (
          _mean_shard_size(
              [b"12", bytearray(b"1234"), memoryview(b"123456")]
          )
          == 4
      )
      # Recursion into lists or tuples; ignore int
      assert _mean_shard_size([(1, 2, [3, b"123456"])]) == 6
      # Don't blindly call sizeof() on unexpected objects
      with pytest.raises(TypeError):
          _mean_shard_size([1.2])
      with pytest.raises(TypeError):
          _mean_shard_size([{1: 2}])
  
imports: from __future__ import annotations
  import pytest
  from distributed.shuffle._core import _mean_shard_size
label_desc: Use image node_id 1 for calling a global function with example usage: test_mean_shard_size() without return types