code: def test_valid_slice(self, dims_spec):
      class MD(DataSetFamily):
          extra_dims = dims_spec
  
          f8 = Column("f8")
          i8 = Column("i8", missing_value=0)
          ob = Column("O")
          M8 = Column("M8[ns]")
          boolean = Column("?")
  
      expected_dims = OrderedDict(
          [(k, frozenset(v)) for k, v in dims_spec]
      )
      assert_equal(MD.extra_dims, expected_dims)
  
      for valid_combination in itertools.product(
          *expected_dims.values()
      ):
          Slice = MD.slice(*valid_combination)
          alternate_constructions = [
              # all positional
              MD.slice(*valid_combination),
              # all keyword
              MD.slice(
                  **dict(zip(expected_dims.keys(), valid_combination))
              ),
              # mix keyword/positional
              MD.slice(
                  *valid_combination[: len(valid_combination) // 2],
                  **dict(
                      list(
                          zip(expected_dims.keys(), valid_combination)
                      )[len(valid_combination) // 2 :],
                  ),
              ),
          ]
          for alt in alternate_constructions:
              assert_is(
                  Slice, alt, msg="Slices are not properly memoized"
              )
  
          expected_coords = OrderedDict(
              zip(expected_dims, valid_combination),
          )
          assert_equal(Slice.extra_coords, expected_coords)
  
          assert_is(Slice.dataset_family, MD)
  
          assert_is_subclass(Slice, DataSetFamilySlice)
  
          expected_columns = {
              ("f8", np.dtype("f8"), Slice),
              ("i8", np.dtype("i8"), Slice),
              ("ob", np.dtype("O"), Slice),
              ("M8", np.dtype("M8[ns]"), Slice),
              ("boolean", np.dtype("?"), Slice),
          }
          actual_columns = {
              (c.name, c.dtype, c.dataset) for c in Slice.columns
          }
          assert_equal(actual_columns, expected_columns)
  
file_path: zipline/tests/pipeline/test_multidimensional_dataset.py
imports: from collections import OrderedDict
  import itertools
  from textwrap import dedent
  from nose_parameterized import parameterized
  import numpy
  from zipline.pipeline.data import Column, DataSetFamily, DataSetFamilySlice
  from zipline.testing import ZiplineTestCase
  from zipline.testing.predicates import assert_equal, assert_is, assert_is_not, assert_is_subclass, assert_raises_str
label_desc: Use image node_id 5 for calling the TestDataSetFamily obj's underlying member method code with example usage: obj.test_valid_slice(dims_spec) without return types