code: def test_raf_transform(data):
      """Tests ReconcileAdditiveForecasts transform and fit_transform"""
      forecasts = data["forecasts"]
      actuals = data["actuals"]
      levels = data["levels"]
      order_dict = data["order_dict"]
      raf = ReconcileAdditiveForecasts()
  
      with pytest.raises(
          NotFittedError, match="Must call `fit` first."
      ):
          raf.transform()
  
      raf.fit(
          forecasts=forecasts,
          actuals=actuals,
          levels=levels,
          order_dict=order_dict,
          method="mint_sample",
      )
  
      # transforms training data
      raf.transform()
      reordered_forecasts = reorder_columns(
          forecasts, order_dict=order_dict
      )
      assert raf.adjusted_forecasts is not None
      assert_equal(
          raf.adjusted_forecasts.columns, reordered_forecasts.columns
      )  # columns are returned according to `order_dict` order
      assert raf.adjusted_forecasts.shape == forecasts.shape
      assert (
          np.linalg.norm(
              raf.constraint_matrix @ np.array(raf.adjusted_forecasts).T
          )
          < 1e-5
      )
      assert raf.adjusted_forecasts_test is None
      assert raf.forecasts_test is None
  
      # transforms test data
      forecasts_test = forecasts + 1.0
      raf.transform(forecasts_test=forecasts_test)
      reordered_forecasts_test = reorder_columns(
          forecasts_test, order_dict=order_dict
      )
      assert_equal(raf.forecasts_test, reordered_forecasts_test)
      assert raf.adjusted_forecasts_test is not None
      assert_equal(
          raf.adjusted_forecasts_test.columns,
          reordered_forecasts_test.columns,
      )
      assert raf.adjusted_forecasts_test.shape == forecasts_test.shape
      assert (
          np.linalg.norm(
              raf.constraint_matrix
              @ np.array(raf.adjusted_forecasts_test).T
          )
          < 1e-5
      )
  
      # fit and transform training data
      raf2 = ReconcileAdditiveForecasts()
      raf2.fit_transform(
          forecasts=forecasts,
          actuals=actuals,
          levels=levels,
          order_dict=order_dict,
          method="ols",
      )
      assert raf2.adjusted_forecasts is not None
      assert_equal(
          raf2.adjusted_forecasts.columns, reordered_forecasts.columns
      )
      assert raf2.adjusted_forecasts.shape == forecasts.shape
      assert (
          np.linalg.norm(
              raf2.constraint_matrix
              @ np.array(raf2.adjusted_forecasts).T
          )
          < 1e-5
      )
      assert raf2.adjusted_forecasts_test is None
      assert raf2.forecasts_test is None
  
imports: import math
  import os
  import warnings
  import cvxpy
  import numpy
  import pandas
  import pytest
  from scipy.linalg import sqrtm
  from sklearn.exceptions import NotFittedError
  from greykite.algo.reconcile.convex.reconcile_forecasts import ReconcileAdditiveForecasts
  from greykite.algo.reconcile.convex.reconcile_forecasts import TraceInfo
  from greykite.algo.reconcile.convex.reconcile_forecasts import apply_method_defaults
  from greykite.algo.reconcile.convex.reconcile_forecasts import evaluation_plot
  from greykite.algo.reconcile.convex.reconcile_forecasts import get_fit_params
  from greykite.algo.reconcile.convex.reconcile_forecasts import get_weight_matrix
  from greykite.algo.reconcile.hierarchical_relationship import HierarchicalRelationship
  from greykite.common.constants import TIME_COL
  from greykite.common.data_loader import DataLoader
  from greykite.common.evaluation import mean_absolute_percent_error
  from greykite.common.evaluation import median_absolute_percent_error
  from greykite.common.evaluation import root_mean_squared_error
  from greykite.common.python_utils import assert_equal
  from greykite.common.python_utils import reorder_columns
label_desc: Use image node_id 11 for calling a global function with example usage: test_raf_transform(data) without return types