code: def test_function(self, data):
      if self.__pending_call_explanation is not None:
          self.debug(self.__pending_call_explanation)
          self.__pending_call_explanation = None
  
      assert isinstance(data.observer, TreeRecordingObserver)
      self.call_count += 1
  
      interrupted = False
      try:
          self.__stoppable_test_function(data)
      except KeyboardInterrupt:
          interrupted = True
          raise
      except BaseException:
          self.save_buffer(data.buffer)
          raise
      finally:
          # No branch, because if we're interrupted we always raise
          # the KeyboardInterrupt, never continue to the code below.
          if not interrupted:  # pragma: no branch
              data.freeze()
              call_stats = {
                  "status": data.status.name.lower(),
                  "runtime": data.finish_time - data.start_time,
                  "drawtime": math.fsum(data.draw_times),
                  "events": sorted(
                      k if v == "" else f"{k}: {v}"
                      for k, v in data.events.items()
                  ),
              }
              self.stats_per_test_case.append(call_stats)
              self.__data_cache[data.buffer] = data.as_result()
  
      self.debug_data(data)
  
      if self.pareto_front is not None and self.pareto_front.add(
          data.as_result()
      ):
          self.save_buffer(data.buffer, sub_key=b"pareto")
  
      assert len(data.buffer) <= BUFFER_SIZE
  
      if data.status >= Status.VALID:
          for k, v in data.target_observations.items():
              self.best_observed_targets[k] = max(
                  self.best_observed_targets[k], v
              )
  
              if k not in self.best_examples_of_observed_targets:
                  self.best_examples_of_observed_targets[
                      k
                  ] = data.as_result()
                  continue
  
              existing_example = self.best_examples_of_observed_targets[
                  k
              ]
              existing_score = existing_example.target_observations[k]
  
              if v < existing_score:
                  continue
  
              if v > existing_score or sort_key(data.buffer) < sort_key(
                  existing_example.buffer
              ):
                  self.best_examples_of_observed_targets[
                      k
                  ] = data.as_result()
  
      if data.status == Status.VALID:
          self.valid_examples += 1
  
      if data.status == Status.INTERESTING:
          key = data.interesting_origin
          changed = False
          try:
              existing = self.interesting_examples[key]
          except KeyError:
              changed = True
              self.last_bug_found_at = self.call_count
              if self.first_bug_found_at is None:
                  self.first_bug_found_at = self.call_count
          else:
              if sort_key(data.buffer) < sort_key(existing.buffer):
                  self.shrinks += 1
                  self.downgrade_buffer(existing.buffer)
                  self.__data_cache.unpin(existing.buffer)
                  changed = True
  
          if changed:
              self.save_buffer(data.buffer)
              self.interesting_examples[key] = data.as_result()
              self.__data_cache.pin(data.buffer)
              self.shrunk_examples.discard(key)
  
          if self.shrinks >= MAX_SHRINKS:
              self.exit_with(ExitReason.max_shrinks)
  
      if (
          not self.ignore_limits
          and self.finish_shrinking_deadline is not None
          and self.finish_shrinking_deadline < time.perf_counter()
      ):
          # See https://github.com/HypothesisWorks/hypothesis/issues/2340
          report(
              "WARNING: Hypothesis has spent more than five minutes working to shrink"
              " a failing example, and stopped because it is making very slow"
              " progress.  When you re-run your tests, shrinking will resume and may"
              " take this long before aborting again.\nPLEASE REPORT THIS if you can"
              " provide a reproducing example, so that we can improve shrinking"
              " performance for everyone."
          )
          self.exit_with(ExitReason.very_slow_shrinking)
  
      if not self.interesting_examples:
          # Note that this logic is reproduced to end the generation phase when
          # we have interesting examples.  Update that too if you change this!
          # (The doubled implementation is because here we exit the engine entirely,
          #  while in the other case below we just want to move on to shrinking.)
          if self.valid_examples >= self.settings.max_examples:
              self.exit_with(ExitReason.max_examples)
          if self.call_count >= max(
              self.settings.max_examples * 10,
              # We have a high-ish default max iterations, so that tests
              # don't become flaky when max_examples is too low.
              1000,
          ):
              self.exit_with(ExitReason.max_iterations)
  
      if self.__tree_is_exhausted():
          self.exit_with(ExitReason.finished)
  
      self.record_for_health_check(data)
  
imports: import math
  import time
  from collections import defaultdict
  from contextlib import contextmanager
  from datetime import timedelta
  from enum import Enum
  from random import Random, getrandbits
  import attr
  from hypothesis import HealthCheck, Phase, Verbosity, settings
  from hypothesis._settings import local_settings
  from hypothesis.errors import StopTest
  from hypothesis.internal.cache import LRUReusedCache
  from hypothesis.internal.compat import ceil, int_from_bytes
  from hypothesis.internal.conjecture.data import ConjectureData, ConjectureResult, DataObserver, Overrun, Status
  from hypothesis.internal.conjecture.datatree import DataTree, PreviouslyUnseenBehaviour, TreeRecordingObserver
  from hypothesis.internal.conjecture.junkdrawer import clamp, ensure_free_stackframes
  from hypothesis.internal.conjecture.pareto import NO_SCORE, ParetoFront, ParetoOptimiser
  from hypothesis.internal.conjecture.shrinker import Shrinker, sort_key
  from hypothesis.internal.healthcheck import fail_health_check
  from hypothesis.reporting import base_report, report
label_desc: Use image node_id 8 for calling the ConjectureRunner obj's underlying member method code with example usage: obj.test_function(data) without return types