code: def test_tree_statistics(
      tree: _FanovaTree, expected_tree_statistics: List[Dict[str, List]]
  ) -> None:
      statistics = tree._statistics
  
      for statistic, expected_statistic in zip(
          statistics, expected_tree_statistics
      ):
          value, weight = statistic
  
          expected_values = expected_statistic["values"]
          expected_weights = expected_statistic["weights"]
          expected_value = numpy.average(
              expected_values, weights=expected_weights
          )
  
          assert math.isclose(value, expected_value)
          assert math.isclose(weight, sum(expected_weights))
  
file_path: optuna/tests/importance_tests/fanova_tests/test_tree.py
imports: import math
  from typing import Dict
  from typing import List
  from typing import Tuple
  from unittest.mock import Mock
  import numpy
  import pytest
  from optuna.importance._fanova._tree import _FanovaTree
label_desc: Use image node_id 6 for calling a global function with example usage: test_tree_statistics(tree, expected_tree_statistics) without return types