code: def test_bell_perm():
      assert [len(set(generate_bell(i))) for i in range(1, 7)] == [
          factorial(i) for i in range(1, 7)
      ]
      assert list(generate_bell(3)) == [
          (0, 1, 2),
          (0, 2, 1),
          (2, 0, 1),
          (2, 1, 0),
          (1, 2, 0),
          (1, 0, 2),
      ]
      # generate_bell and trotterjohnson are advertised to return the same
      # permutations; this is not technically necessary so this test could
      # be removed
      for n in range(1, 5):
          p = Permutation(range(n))
          b = generate_bell(n)
          for bi in b:
              assert bi == tuple(p.array_form)
              p = p.next_trotterjohnson()
      raises(ValueError, lambda: list(generate_bell(0)))
  
imports: from textwrap import dedent
  from itertools import islice, product
  from sympy.core.basic import Basic
  from sympy.core.numbers import Integer
  from sympy.core.sorting import ordered
  from sympy.core.symbol import Dummy, symbols
  from sympy.functions.combinatorial.factorials import factorial
  from sympy.matrices.dense import Matrix
  from sympy.combinatorics import RGS_enum, RGS_unrank, Permutation
  from sympy.utilities.iterables import _partition, _set_partitions, binary_partitions, bracelets, capture, cartes, common_prefix, common_suffix, connected_components, dict_merge, filter_symbols, flatten, generate_bell, generate_derangements, generate_involutions, generate_oriented_forest, group, has_dups, ibin, iproduct, kbins, minlex, multiset, multiset_combinations, multiset_partitions, multiset_permutations, necklaces, numbered_symbols, partitions, permutations, postfixes, prefixes, reshape, rotate_left, rotate_right, runs, sift, strongly_connected_components, subsets, take, topological_sort, unflatten, uniq, variations, ordered_partitions, rotations, is_palindromic, iterable, NotIterable, multiset_derangements, signed_permutations, sequence_partitions, sequence_partitions_empty
  from sympy.utilities.enumerative import factoring_visitor, multiset_partitions_taocp
  from sympy.core.singleton import S
  from sympy.testing.pytest import raises, warns_deprecated_sympy
label_desc: Use image node_id 25 for calling a global function with example usage: test_bell_perm() without return types