code: def test_parent_session_overrides_child_session():
      with _TrainingSession(PARENT, allow_children=False) as p:
          assert_session_stack([(None, PARENT)])
  
          with _TrainingSession(CHILD, allow_children=True) as c:
              assert_session_stack([(None, PARENT), (PARENT, CHILD)])
  
              with _TrainingSession(
                  GRAND_CHILD, allow_children=True
              ) as g:
                  assert_session_stack(
                      [
                          (None, PARENT),
                          (PARENT, CHILD),
                          (CHILD, GRAND_CHILD),
                      ]
                  )
  
                  assert p.should_log()
                  assert not c.should_log()
                  assert not g.should_log()
  
              assert_session_stack([(None, PARENT), (PARENT, CHILD)])
          assert_session_stack([(None, PARENT)])
      assert_session_stack([])
  
file_path: mlflow/tests/autologging/test_training_session.py
imports: import pytest
  from mlflow.utils.autologging_utils import _get_new_training_session_class
label_desc: Use image node_id 7 for calling a global function with example usage: test_parent_session_overrides_child_session() without return types