code: def test_namespaces():
      def side_effect(
          state: AnalysisState, args: AnalysisState, **fit_kwargs
      ):
          state.upd = fit_kwargs
  
      inner_analysis: BaseAnalysis = BaseAnalysis(arg=1)
      inner_analysis._fit = MagicMock()
      inner_analysis._fit.side_effect = side_effect
  
      # write outputs into ns1
      state = BaseAnalysis(
          children=[
              Namespace(namespace="ns1", children=[inner_analysis])
          ]
      ).fit(op="fit1")
  
      # write outputs into ns2
      state = BaseAnalysis(
          state=state,
          children=[
              Namespace(namespace="ns2", children=[inner_analysis])
          ],
      ).fit(op="fit2")
  
      # update outputs in ns2
      state = BaseAnalysis(
          state=state,
          children=[
              Namespace(namespace="ns2", children=[inner_analysis])
          ],
      ).fit(op="fit3")
  
      assert state == {
          "ns1": {"upd": {"op": "fit1"}},
          "ns2": {"upd": {"op": "fit3"}},
      }
  
file_path: autogluon/eda/tests/unittests/analysis/test_base.py
imports: from unittest.mock import MagicMock
  import pandas
  import pytest
  from autogluon.eda import AnalysisState
  from autogluon.eda.analysis import Namespace
  from autogluon.eda.analysis.base import AbstractAnalysis, BaseAnalysis, SaveArgsToState
label_desc: Use image node_id 8 for calling a global function with example usage: test_namespaces() without return types