code: def test_real_case_metric_binary(requests_mock: Mocker):
      BASE_DIR = os.path.join(
          os.path.dirname(os.path.realpath(__file__)),
          "test_data/",
      )
  
      url = "http://fake_url2"
      mock_default_requests(requests_mock, url)
      search_task_id = mock_initial_search(requests_mock, url)
      mock_initial_progress(requests_mock, url, search_task_id)
      ads_search_task_id = mock_initial_summary(
          requests_mock,
          url,
          search_task_id,
      )
      requests_mock.get(
          url + f"/public/api/v2/search/{search_task_id}/metadata",
          json={
              "fileUploadId": "123",
              "fileMetadataId": "123",
              "name": "test",
              "description": "",
              "columns": [
                  {
                      "index": 0,
                      "name": "score",
                      "originalName": "score",
                      "dataType": "INT",
                      "meaningType": "FEATURE",
                  },
                  {
                      "index": 1,
                      "name": "request_date",
                      "originalName": "request_date",
                      "dataType": "INT",
                      "meaningType": "DATE",
                  },
                  {
                      "index": 2,
                      "name": "target",
                      "originalName": "target",
                      "dataType": "INT",
                      "meaningType": "DATE",
                  },
                  {
                      "index": 3,
                      "name": "system_record_id",
                      "originalName": "system_record_id",
                      "dataType": "INT",
                      "meaningType": "SYSTEM_RECORD_ID",
                  },
              ],
              "searchKeys": [["rep_date"]],
              "hierarchicalGroupKeys": [],
              "hierarchicalSubgroupKeys": [],
              "rowsCount": 30505,
          },
      )
      mock_get_task_metadata_v2(
          requests_mock,
          url,
          ads_search_task_id,
          ProviderTaskMetadataV2(
              features=[
                  FeaturesMetadataV2(
                      name="score",
                      type="numeric",
                      source="etalon",
                      hit_rate=100.0,
                      shap_value=0.368092,
                  ),
              ],
              hit_rate_metrics=HitRateMetrics(
                  etalon_row_count=10000,
                  max_hit_count=10000,
                  hit_rate=1.0,
                  hit_rate_percent=100.0,
              ),
              eval_set_metrics=[
                  ModelEvalSet(
                      eval_set_index=1,
                      hit_rate=1.0,
                      hit_rate_metrics=HitRateMetrics(
                          etalon_row_count=1000,
                          max_hit_count=1000,
                          hit_rate=1.0,
                          hit_rate_percent=100.0,
                      ),
                  ),
              ],
          ),
      )
      path_to_mock_features = os.path.join(
          BASE_DIR, "real_enriched_x.parquet"
      )
      mock_raw_features(
          requests_mock, url, search_task_id, path_to_mock_features
      )
  
      train = pd.read_parquet(
          os.path.join(BASE_DIR, "real_train.parquet")
      )
      X = train[["request_date", "score"]]
      y = train["target1"].rename("target")
      test = pd.read_parquet(
          os.path.join(BASE_DIR, "real_test.parquet")
      )
      eval_set = [
          (
              test[["request_date", "score"]],
              test["target1"].rename("target"),
          )
      ]
  
      search_keys = {"request_date": SearchKey.DATE}
      enricher = FeaturesEnricher(
          search_keys=search_keys,
          endpoint=url,
          api_key="fake_api_key",
          date_format="%Y-%m-%d",
          country_code="RU",
          search_id=search_task_id,
          logs_enabled=False,
      )
  
      enricher.X = X
      enricher.y = y
      enricher.eval_set = eval_set
  
      enriched_X = pd.read_parquet(
          os.path.join(BASE_DIR, "real_enriched_x.parquet")
      )
      enriched_eval_x = pd.read_parquet(
          os.path.join(BASE_DIR, "real_enriched_eval_x.parquet")
      )
  
      sampled_Xy = X.copy()
      sampled_Xy["target"] = y
      sampled_Xy = sampled_Xy[sampled_Xy.index.isin(enriched_X.index)]
      sampled_X = sampled_Xy.drop(columns="target")
      sampled_y = sampled_Xy["target"]
      enricher._FeaturesEnricher__cached_sampled_datasets = (
          sampled_X,
          sampled_y,
          enriched_X,
          {0: (eval_set[0][0], enriched_eval_x, eval_set[0][1])},
          search_keys,
      )
  
      metrics = enricher.calculate_metrics()
      print(metrics)
  
      expected_metrics = pd.DataFrame(
          {
              segment_header: [train_segment, eval_1_segment],
              rows_header: [6582, 2505],
              target_mean_header: [0.5, 0.8854],
              baseline_gini: [0.486038, 0.450277],
          }
      )
  
      assert_frame_equal(expected_metrics, metrics)
  
imports: import datetime
  import os
  import numpy
  import pandas
  import pytest
  from catboost import CatBoostClassifier
  from pandas.testing import assert_frame_equal
  from requests_mock.mocker import Mocker
  from sklearn.ensemble import RandomForestClassifier
  from upgini import FeaturesEnricher, SearchKey
  from upgini.errors import ValidationError
  from upgini.metadata import CVType, FeaturesMetadataV2, HitRateMetrics, ModelEvalSet, ProviderTaskMetadataV2
  from upgini.resource_bundle import bundle
  from upgini.search_task import SearchTask
  from .utils import mock_default_requests, mock_get_metadata, mock_get_task_metadata_v2, mock_initial_progress, mock_initial_search, mock_initial_summary, mock_raw_features, mock_validation_progress, mock_validation_raw_features, mock_validation_search, mock_validation_summary
label_desc: Use image node_id 1 for calling a global function with example usage: test_real_case_metric_binary(requests_mock) without return types