code: def test_n_chunks(xs, n):
      singletons = list(map(lambda x: [x], xs))
  
      # If the chunks equal the length we get all singletons.
      assert u.n_chunks(xs, len(xs)) == singletons
  
      # one chunk returns a single singleton.
      assert u.n_chunks(xs, 1) == [xs]
  
      sharded = u.n_chunks(xs, n)
      recombined = list(itertools.chain(*sharded))
  
      # The ordering might not be the same, but the total number of items is the
      # same if we break down and recombine.
      assert len(recombined) == len(xs)
  
      # And the items are equal too.
      assert set(xs) == set(recombined)
  
imports: import itertools
  import json
  import os
  import uuid
  from collections import OrderedDict
  from enum import Enum
  from typing import Union
  import hypothesis.strategies
  from hypothesis import given
  import caliban.util
  import pytest
label_desc: Use image node_id 15 for calling a global function with example usage: test_n_chunks(xs, n) without return types