docstr: This test is for testing if it will raise error if the `to_date` is out of the boundary.
docstr_tok: ["This","test","is","for","testing","if","it","will","raise","error","if","the","`","to_date","`","is","out","of","the","boundary","."]
code: def test_update_pred(self):
      """
      This test is for testing if it will raise error if the `to_date` is out of the boundary.
      """
      task = copy.deepcopy(CSI300_GBDT_TASK)
  
      task["record"] = ["qlib.workflow.record_temp.SignalRecord"]
  
      exp_name = "online_srv_test"
  
      cal = D.calendar()
      latest_date = cal[-1]
  
      train_start = latest_date - pd.Timedelta(days=61)
      train_end = latest_date - pd.Timedelta(days=41)
      task["dataset"]["kwargs"]["segments"] = {
          "train": (train_start, train_end),
          "valid": (
              latest_date - pd.Timedelta(days=40),
              latest_date - pd.Timedelta(days=21),
          ),
          "test": (latest_date - pd.Timedelta(days=20), latest_date),
      }
  
      task["dataset"]["kwargs"]["handler"]["kwargs"] = {
          "start_time": train_start,
          "end_time": latest_date,
          "fit_start_time": train_start,
          "fit_end_time": train_end,
          "instruments": "csi300",
      }
  
      rec = task_train(task, exp_name)
  
      pred = rec.load_object("pred.pkl")
  
      online_tool = OnlineToolR(exp_name)
      online_tool.reset_online_tag(rec)  # set to online model
  
      online_tool.update_online_pred(
          to_date=latest_date + pd.Timedelta(days=10)
      )
  
      good_pred = rec.load_object("pred.pkl")
  
      mod_range = slice(
          latest_date - pd.Timedelta(days=20),
          latest_date - pd.Timedelta(days=10),
      )
      mod_range2 = slice(
          latest_date - pd.Timedelta(days=9),
          latest_date - pd.Timedelta(days=2),
      )
      mod_pred = good_pred.copy()
  
      mod_pred.loc[mod_range] = -1
      mod_pred.loc[mod_range2] = -2
  
      rec.save_objects(**{"pred.pkl": mod_pred})
      online_tool.update_online_pred(
          to_date=latest_date - pd.Timedelta(days=10),
          from_date=latest_date - pd.Timedelta(days=20),
      )
  
      updated_pred = rec.load_object("pred.pkl")
  
      # this range is not fixed
      self.assertTrue(
          (updated_pred.loc[mod_range] == good_pred.loc[mod_range])
          .all()
          .item()
      )
      # this range is fixed now
      self.assertTrue((updated_pred.loc[mod_range2] == -2).all().item())
  
file_path: qlib/tests/rolling_tests/test_update_pred.py
imports: import copy
  import unittest
  import pytest
  import fire
  import pandas
  import qlib
  from qlib.data import D
  from qlib.model.trainer import task_train
  from qlib.tests import TestAutoData
  from qlib.tests.config import CSI300_GBDT_TASK
  from qlib.workflow.online.utils import OnlineToolR
  from qlib.workflow.online.update import LabelUpdater
label_desc: Use image node_id 1 for calling the TestRolling obj's underlying member method code with example usage: obj.test_update_pred() without return types