code: def test_partition(n, k):
      """Test that random_partition returns a disjoint partition."""
      part = random_partition(n, k)
  
      assert isinstance(part, list)
      assert all(isinstance(x, list) for x in part)
      assert all(isinstance(x, int) for y in part for x in y)
  
      low_size = n // k
      hi_size = low_size + 1
      assert all(len(x) == low_size or len(x) == hi_size for x in part)
  
      part_union = set()
      for x in part:
          part_union = part_union.union(x)
      assert set(range(n)) == part_union
  
      for i, x in enumerate(part):
          for j, y in enumerate(part):
              if i != j:
                  assert len(set(x).intersection(y)) == 0
  
file_path: sktime/sktime/utils/tests/test_sampling.py
imports: import numpy
  import pytest
  from sktime.datasets import load_unit_test
  from sktime.datatypes import check_is_scitype
  from sktime.utils._testing.deep_equals import deep_equals
  from sktime.utils.sampling import random_partition, stratified_resample
label_desc: Use image node_id 1 for calling a global function with example usage: test_partition(n, k) without return types