docstr: Run the test function many times, on database input and generated
  input, using the Conjecture engine.
docstr_tok: ["Run","the","test","function","many","times",",","on","database","input","and","generated","input",",","using","the","Conjecture","engine","."]
code: def run_engine(self):
      """Run the test function many times, on database input and generated
      input, using the Conjecture engine.
      """
      # Tell pytest to omit the body of this function from tracebacks
      __tracebackhide__ = True
      try:
          database_key = (
              self.wrapped_test._hypothesis_internal_database_key
          )
      except AttributeError:
          if global_force_seed is None:
              database_key = function_digest(self.test)
          else:
              database_key = None
  
      runner = ConjectureRunner(
          self._execute_once_for_engine,
          settings=self.settings,
          random=self.random,
          database_key=database_key,
      )
      # Use the Conjecture engine to run the test function many times
      # on different inputs.
      runner.run()
      note_engine_for_statistics(runner)
  
      if runner.call_count == 0:
          return
      if runner.interesting_examples:
          self.falsifying_examples = sorted(
              runner.interesting_examples.values(),
              key=lambda d: sort_key(d.buffer),
              reverse=True,
          )
      else:
          if runner.valid_examples == 0:
              raise Unsatisfiable(
                  "Unable to satisfy assumptions of hypothesis %s."
                  % (get_pretty_function_description(self.test),)
              )
  
      if not self.falsifying_examples:
          return
      elif not self.settings.report_multiple_bugs:
          # Pretend that we only found one failure, by discarding the others.
          del self.falsifying_examples[:-1]
  
      # The engine found one or more failures, so we need to reproduce and
      # report them.
  
      self.failed_normally = True
  
      flaky = 0
  
      for falsifying_example in self.falsifying_examples:
          info = falsifying_example.extra_information
  
          ran_example = ConjectureData.for_buffer(
              falsifying_example.buffer
          )
          self.__was_flaky = False
          assert info.__expected_exception is not None
          try:
              self.execute_once(
                  ran_example,
                  print_example=not self.is_find,
                  is_final=True,
                  expected_failure=(
                      info.__expected_exception,
                      info.__expected_traceback,
                  ),
              )
          except (UnsatisfiedAssumption, StopTest):
              report(traceback.format_exc())
              self.__flaky(
                  "Unreliable assumption: An example which satisfied "
                  "assumptions on the first run now fails it."
              )
          except BaseException as e:
              if len(self.falsifying_examples) <= 1:
                  # There is only one failure, so we can report it by raising
                  # it directly.
                  raise
  
              # We are reporting multiple failures, so we need to manually
              # print each exception's stack trace and information.
              tb = get_trimmed_traceback()
              report(
                  "".join(traceback.format_exception(type(e), e, tb))
              )
  
          finally:  # pragma: no cover
              # Mostly useful for ``find`` and ensuring that objects that
              # hold on to a reference to ``data`` know that it's now been
              # finished and they shouldn't attempt to draw more data from
              # it.
              ran_example.freeze()
  
              # This section is in fact entirely covered by the tests in
              # test_reproduce_failure, but it seems to trigger a lovely set
              # of coverage bugs: The branches show up as uncovered (despite
              # definitely being covered - you can add an assert False else
              # branch to verify this and see it fail - and additionally the
              # second branch still complains about lack of coverage even if
              # you add a pragma: no cover to it!
              # See https://bitbucket.org/ned/coveragepy/issues/623/
              if self.settings.print_blob:
                  report(
                      (
                          "\nYou can reproduce this example by temporarily "
                          "adding @reproduce_failure(%r, %r) as a decorator "
                          "on your test case"
                      )
                      % (
                          __version__,
                          encode_failure(falsifying_example.buffer),
                      )
                  )
          if self.__was_flaky:
              flaky += 1
  
      # If we only have one example then we should have raised an error or
      # flaky prior to this point.
      assert len(self.falsifying_examples) > 1
  
      if flaky > 0:
          raise Flaky(
              (
                  "Hypothesis found %d distinct failures, but %d of them "
                  "exhibited some sort of flaky behaviour."
              )
              % (len(self.falsifying_examples), flaky)
          )
      else:
          raise MultipleFailures(
              ("Hypothesis found %d distinct failures.")
              % (len(self.falsifying_examples))
          )
  
imports: from __future__ import absolute_import, division, print_function
  import base64
  import contextlib
  import datetime
  import inspect
  import random
  import sys
  import traceback
  import warnings
  import zlib
  from random import Random
  from unittest import TestCase
  import attr
  import hypothesis.strategies
  from hypothesis._settings import HealthCheck, Phase, Verbosity, local_settings, settings
  from hypothesis.control import BuildContext
  from hypothesis.errors import DeadlineExceeded, DidNotReproduce, FailedHealthCheck, Flaky, Found, HypothesisDeprecationWarning, HypothesisWarning, InvalidArgument, MultipleFailures, NoSuchExample, Unsatisfiable, UnsatisfiedAssumption
  from hypothesis.executors import new_style_executor
  from hypothesis.internal.compat import PY2, bad_django_TestCase, benchmark_time, binary_type, get_type_hints, getfullargspec, hbytes, int_from_bytes, qualname
  from hypothesis.internal.conjecture.data import ConjectureData, StopTest
  from hypothesis.internal.conjecture.engine import ConjectureRunner, sort_key
  from hypothesis.internal.entropy import deterministic_PRNG
  from hypothesis.internal.escalation import escalate_hypothesis_internal_error, get_trimmed_traceback
  from hypothesis.internal.healthcheck import fail_health_check
  from hypothesis.internal.reflection import arg_string, convert_positional_arguments, define_function_signature, function_digest, get_pretty_function_description, impersonate, is_mock, proxies
  from hypothesis.reporting import current_verbosity, report, verbose_report, with_reporter
  from hypothesis.statistics import note_engine_for_statistics
  from hypothesis.strategies._internal.collections import TupleStrategy
  from hypothesis.strategies._internal.strategies import MappedSearchStrategy, SearchStrategy
  from hypothesis.utils.conventions import infer
  from hypothesis.vendor.pretty import CUnicodeIO, RepresentationPrinter
  from hypothesis.version import __version__
label_desc: Use image node_id 4 for calling the StateForActualGivenExecution obj's underlying member method code with example usage: obj.run_engine() without return types