class_docstr: A test runner class that displays results in textual form.
  
  It prints out the names of tests as they are run, errors as they
  occur, and a summary of the results at the end of the test run.
class_docstr_tok: ["A","test","runner","class","that","displays","results","in","textual","form",".","It","prints","out","the","names","of","tests","as","they","are","run",",","errors","as","they","occur",",","and","a","summary","of","the","results","at","the","end","of","the","test","run","."]
docstr: Run the given test case or test suite.
docstr_tok: ["Run","the","given","test","case","or","test","suite","."]
code: def run(self, test):
      "Run the given test case or test suite."
      result = self._makeResult()
      registerResult(result)
      result.failfast = self.failfast
      result.buffer = self.buffer
      result.tb_locals = self.tb_locals
      with warnings.catch_warnings():
          if self.warnings:
              # if self.warnings is set, use it to filter all the warnings
              warnings.simplefilter(self.warnings)
          startTime = time.perf_counter()
          startTestRun = getattr(result, "startTestRun", None)
          if startTestRun is not None:
              startTestRun()
          try:
              test(result)
          finally:
              stopTestRun = getattr(result, "stopTestRun", None)
              if stopTestRun is not None:
                  stopTestRun()
          stopTime = time.perf_counter()
      timeTaken = stopTime - startTime
      result.printErrors()
      if self.durations is not None:
          self._printDurations(result)
  
      if hasattr(result, "separator2"):
          self.stream.writeln(result.separator2)
  
      run = result.testsRun
      self.stream.writeln(
          "Ran %d test%s in %.3fs"
          % (run, run != 1 and "s" or "", timeTaken)
      )
      self.stream.writeln()
  
      expectedFails = unexpectedSuccesses = skipped = 0
      try:
          results = map(
              len,
              (
                  result.expectedFailures,
                  result.unexpectedSuccesses,
                  result.skipped,
              ),
          )
      except AttributeError:
          pass
      else:
          expectedFails, unexpectedSuccesses, skipped = results
  
      infos = []
      if not result.wasSuccessful():
          self.stream.write("FAILED")
          failed, errored = len(result.failures), len(result.errors)
          if failed:
              infos.append("failures=%d" % failed)
          if errored:
              infos.append("errors=%d" % errored)
      elif run == 0 and not skipped:
          self.stream.write("NO TESTS RAN")
      else:
          self.stream.write("OK")
      if skipped:
          infos.append("skipped=%d" % skipped)
      if expectedFails:
          infos.append("expected failures=%d" % expectedFails)
      if unexpectedSuccesses:
          infos.append("unexpected successes=%d" % unexpectedSuccesses)
      if infos:
          self.stream.writeln(" (%s)" % (", ".join(infos),))
      else:
          self.stream.write("\n")
      self.stream.flush()
      return result
  
imports: import sys
  import time
  import warnings
  from .None import result
  from .case import _SubTest
  from .signals import registerResult
label_desc: Use image node_id 4 for calling the TextTestRunner obj's underlying member method code with example usage: obj.run(test) and returns: result