code: def test_linear_tree_model_multi_var():
      # construct a LinearTreeDefinition
      regr = linear_model_tree(X=X, y=Y)
      input_bounds = {
          0: (min(X[:, 0]), max(X[:, 0])),
          1: (min(X[:, 1]), max(X[:, 1])),
      }
      ltmodel_small = LinearTreeDefinition(
          regr, unscaled_input_bounds=input_bounds
      )
  
      scaled_input_bounds = ltmodel_small.scaled_input_bounds
      n_inputs = ltmodel_small.n_inputs
      n_outputs = ltmodel_small.n_outputs
      splits = ltmodel_small.splits
      leaves = ltmodel_small.leaves
      thresholds = ltmodel_small.thresholds
  
      # assert attributes in LinearTreeDefinition
      assert scaled_input_bounds is not None
      assert n_inputs == 2
      assert n_outputs == 1
  
      # test for splits
      # assert the number of splits
      assert len(splits[0].keys()) == 5
      splits_key_list = [
          "col",
          "th",
          "loss",
          "samples",
          "parent",
          "children",
          "models",
          "left_leaves",
          "right_leaves",
          "y_index",
      ]
      # assert whether all the dicts have such keys
      for i in splits[0].keys():
          for key in splits[0][i].keys():
              assert key in splits_key_list
      # test for leaves
      # assert the number of leaves
      assert len(leaves[0].keys()) == 6
      # assert whether all the dicts have such keys
      leaves_key_list = [
          "loss",
          "samples",
          "models",
          "slope",
          "intercept",
          "parent",
          "bounds",
      ]
      for j in leaves[0].keys():
          for key in leaves[0][j].keys():
              assert key in leaves_key_list
              # if the key is slope, test the shape of it
              if key == "slope":
                  assert len(leaves[0][j][key]) == n_inputs
              # elif the key is bounds, test the lb <= ub
              elif key == "bounds":
                  features = leaves[0][j][key].keys()
                  for k in range(len(features)):
                      lb = leaves[0][j][key][k][0]
                      ub = leaves[0][j][key][k][1]
                      # there is chance that don't have lb and ub at this step
                      if lb is not None and ub is not None:
                          assert lb <= ub
      # test for thresholds
      # assert whether each feature has threshold
      assert len(thresholds[0].keys()) == n_inputs
      # assert the number of thresholds
      thresholds_count = 0
      for k in range(len(thresholds[0].keys())):
          for _ in range(len(thresholds[0][k].keys())):
              thresholds_count += 1
      assert thresholds_count == len(splits[0].keys())
  
imports: import numpy
  import pyomo.environ
  import pytest
  from omlt.dependencies import lineartree_available
  from pytest import approx
  from omlt import OmltBlock
  import omlt
label_desc: Use image node_id 8 for calling a global function with example usage: test_linear_tree_model_multi_var() without return types