class_docstr: Check if test dates are present in train data.
  
  Parameters
  ----------
  n_to_show : int , default: 5
      Number of common dates to show.
  n_samples : int , default: 10_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
docstr: Run check.
  
  Returns
  -------
  CheckResult
      value is the ratio of date leakage.
      data is html display of the checks' textual result.
  
  Raises
  ------
  DeepchecksValueError
      If one of the datasets is not a Dataset instance with an date
docstr_tok: ["Run","check",".","Returns","--","--","--","-","CheckResult","value","is","the","ratio","of","date","leakage",".","data","is","html","display","of","the","checks","'","textual","result",".","Raises","--","--","--","DeepchecksValueError","If","one","of","the","datasets","is","not","a","Dataset","instance","with","an","date"]
code: def run_logic(self, context: Context) -> CheckResult:
      """Run check.
  
      Returns
      -------
      CheckResult
          value is the ratio of date leakage.
          data is html display of the checks' textual result.
  
      Raises
      ------
      DeepchecksValueError
          If one of the datasets is not a Dataset instance with an date
      """
      train_dataset = context.train.sample(
          self.n_samples, random_state=self.random_state
      )
      test_dataset = context.test.sample(
          self.n_samples, random_state=self.random_state
      )
  
      train_dataset.assert_datetime()
      train_date = train_dataset.datetime_col
      test_date = test_dataset.datetime_col
  
      date_intersection = tuple(set(train_date).intersection(test_date))
  
      if len(date_intersection) > 0:
          leakage_ratio = (
              len([x for x in test_date if x in date_intersection])
              / test_dataset.n_samples
          )
          return_value = leakage_ratio
  
          if context.with_display:
              text = f"{format_percent(leakage_ratio)} of test data dates appear in training data"
              table = pd.DataFrame(
                  [
                      [
                          list(
                              format_datetime(it)
                              for it in date_intersection[
                                  : self.n_to_show
                              ]
                          )
                      ]
                  ],
                  index=["Sample of test dates in train:"],
                  columns=["duplicate values"],
              )
              display = [text, table]
          else:
              display = None
  
      else:
          display = None
          return_value = 0
  
      return CheckResult(
          value=return_value,
          header="Date Train-Test Leakage (duplicates)",
          display=display,
      )
  
file_path: deepchecks/deepchecks/tabular/checks/train_test_validation/date_train_test_leakage_duplicates.py
imports: import pandas
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.tabular import Context, TrainTestCheck
  from deepchecks.utils.strings import format_datetime, format_percent
label_desc: Use image node_id 2 for calling the DateTrainTestLeakageDuplicates obj's underlying member method code with example usage: obj.run_logic(context) and returns: CheckResult