code: def test_mtype_infer(scitype, mtype, fixture_index):
      """Tests that mtype correctly infers the mtype of examples.
  
      Parameters
      ----------
      scitype : str - scitype of fixture
      mtype : str - mtype of fixture
      fixture_index : int - index of fixture tuple with that scitype and mtype
  
      Raises
      ------
      RuntimeError if scitype is not defined or has no mtypes or examples
      AssertionError if mtype of examples is not correctly identified
      error if check itself raises an error
      """
      # if mtypes are ambiguous, then this test should be skipped
      if scitype in SCITYPES_AMBIGUOUS_MTYPE:
          return None
  
      # retrieve fixture for checking
      fixture = get_examples(mtype=mtype, as_scitype=scitype).get(
          fixture_index
      )
  
      # todo: possibly remove this once all checks are defined
      check_is_defined = (mtype, scitype) in check_dict.keys()
  
      # check fixtures that exist against checks that exist
      if fixture is not None and check_is_defined:
          assert mtype == infer_mtype(
              fixture, as_scitype=scitype, exclude_mtypes=[]
          ), f"mtype {mtype} not correctly identified for fixture {fixture_index}"
  
      # check indirect mtype inference via check_is_scitype
      if fixture is not None and check_is_defined:
          scitype_res = check_is_scitype(
              fixture,
              scitype=scitype,
              exclude_mtypes=[],
              return_metadata=[],
          )
          inferred_mtype = scitype_res[2]["mtype"]
          assert (
              mtype == inferred_mtype
          ), f"mtype {mtype} not correctly identified for fixture {fixture_index}"
  
file_path: sktime/sktime/datatypes/tests/test_check.py
imports: import numpy
  from sktime.datatypes._check import AMBIGUOUS_MTYPES, check_dict, check_is_mtype, check_is_scitype
  from sktime.datatypes._check import mtype
  from sktime.datatypes._check import scitype
  from sktime.datatypes._examples import get_examples
  from sktime.datatypes._registry import SCITYPE_LIST, scitype_to_mtype
label_desc: Use image node_id 8 for calling a global function with example usage: test_mtype_infer(scitype, mtype, fixture_index) and returns: None