code: def test_get_bucket_number(
      num_keys,
      num_buckets,
      max_hkey,
      expected_non_empty_shards,
      expected_min_bucket_size,
      expected_max_bucket_size,
  ):
      shards = [
          shuffle.get_bucket_number(
              hkey=k, num_buckets=num_buckets, max_hkey=max_hkey
          )
          for k in range(num_keys)
      ]
      # Check shard(x) <= shard(y) if x < y.
      previous_shard = 0
      for shard in shards:
          assert shard >= previous_shard
          previous_shard = shard
      # Check distribution: all shards are used.
      counts = collections.Counter(shards)
      assert len(counts) == expected_non_empty_shards
      for bucket_size in counts.values():
          assert bucket_size >= expected_min_bucket_size
          assert bucket_size <= expected_max_bucket_size
  
imports: import collections
  import contextlib
  import logging
  import resource
  import tempfile
  from absl.testing.absltest import mock
  import pytest
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import shuffle
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: test_get_bucket_number(num_keys, num_buckets, max_hkey, expected_non_empty_shards, expected_min_bucket_size, expected_max_bucket_size) without return types