code: def test_components():
      """Tests component retrieval.
  
      Raises
      ------
      AssertionError if logic behind _components is incorrect, logic tested:
          calling _components on a non-composite returns an empty dict
          calling _components on a composite returns name/BaseObject pair in dict,
          and BaseObject returned is identical with attribute of the same name
      """
      non_composite = CompositionDummy(foo=42)
      composite = CompositionDummy(foo=non_composite)
  
      non_comp_comps = non_composite._components()
      comp_comps = composite._components()
  
      assert isinstance(non_comp_comps, dict)
      assert set(non_comp_comps.keys()) == set()
  
      assert isinstance(comp_comps, dict)
      assert set(comp_comps.keys()) == {"foo_"}
      assert comp_comps["foo_"] is composite.foo_
      assert comp_comps["foo_"] is not composite.foo
  
imports: from copy import deepcopy
  import pytest
  from sktime.base import BaseEstimator, BaseObject
  from sktime.utils.validation._dependencies import _check_soft_dependencies
label_desc: Use image node_id 10 for calling a global function with example usage: test_components() without return types