code: def test_median_stopping_rule():
      results_df = pandas.DataFrame(
          collections.OrderedDict(
              [
                  ("Trial-ID", [1] * 3 + [2] * 3 + [3] * 3),
                  ("Status", ["INTERMEDIATE"] * 9),
                  ("Iteration", [1, 2, 3] * 3),
                  ("a", [1, 1, 1] * 3),
                  ("b", [2, 2, 2] * 3),
                  ("Objective", [0.1] * 3 + [0.2] * 3 + [0.3] * 3),
              ]
          )
      )
  
      stopper = sherpa.algorithms.MedianStoppingRule(
          min_iterations=2, min_trials=1
      )
  
      t = get_test_trial(id=3)
  
      assert stopper.should_trial_stop(
          trial=t, results=results_df, lower_is_better=True
      )
  
      stopper = sherpa.algorithms.MedianStoppingRule(
          min_iterations=4, min_trials=1
      )
      assert not stopper.should_trial_stop(
          trial=t, results=results_df, lower_is_better=True
      )
  
      stopper = sherpa.algorithms.MedianStoppingRule(
          min_iterations=2, min_trials=4
      )
      assert not stopper.should_trial_stop(
          trial=t, results=results_df, lower_is_better=True
      )
  
imports: from __future__ import absolute_import
  import collections
  import pandas
  import numpy
  import sherpa
  import logging
  import itertools
  import pytest
  from testing_utils import *
label_desc: Use image node_id 1 for calling a global function with example usage: test_median_stopping_rule() without return types