code: def test_nested_set_params_and_alias():
      """Tests that nested param setting works correctly.
  
      This specifically tests that parameters of components can be provided,
      even if that component is not present in the object that set_params is called on,
      but is also being set in the same set_params call.
  
      Also tests alias resolution, using recursive end state after set_params.
  
      Raises
      ------
      AssertionError if parameters that should be set via __ are not set
      AssertionError if error that should be raised is not raised
      """
      non_composite = AliasTester(a=42, bar=4242)
      composite = CompositionDummy(foo=0)
  
      # this should write to a of foo
      # potential error here is that composite does not have foo__a to start with
      # so error catching or writing foo__a to early could cause an exception
      composite.set_params(**{"foo": non_composite, "foo__a": 424242})
      assert composite.get_params()["foo__a"] == 424242
  
      non_composite = AliasTester(a=42, bar=4242)
      composite = CompositionDummy(foo=0)
  
      # same, and recognizing that foo__a is the only matching suffix in the end state
      composite.set_params(**{"foo": non_composite, "a": 424242})
      assert composite.get_params()["foo__a"] == 424242
  
      # new example: highly nested composite with identical suffixes
      non_composite1 = composite
      non_composite2 = AliasTester(a=42, bar=4242)
      uber_composite = CompositionDummy(foo=42, bar=42)
  
      # trying to write to a should raise an exception
      # since there are two suffix a, and a is not a full parameter string
      with pytest.raises(
          ValueError, match=r"does not uniquely determine parameter key"
      ):
          uber_composite.set_params(
              **{
                  "a": 424242,
                  "foo": non_composite1,
                  "bar": non_composite2,
              }
          )
  
      uber_composite = CompositionDummy(foo=non_composite1, bar=42)
  
      # same as above, should overwrite "bar" of uber_composite
      uber_composite.set_params(**{"bar": 424243})
      assert uber_composite.get_params()["bar"] == 424243
  
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 12 for calling a global function with example usage: test_nested_set_params_and_alias() without return types