class_docstr: `~unittest.TestCase` subclass for testing `.IOLoop`-based
  asynchronous code.
  
  The unittest framework is synchronous, so the test must be
  complete by the time the test method returns.  This means that
  asynchronous code cannot be used in quite the same way as usual.
  To write test functions that use the same ``yield``-based patterns
  used with the `tornado.gen` module, decorate your test methods
  with `tornado.testing.gen_test` instead of
  `tornado.gen.coroutine`.  This class also provides the `stop()`
  and `wait()` methods for a more manual style of testing.  The test
  method itself must call ``self.wait()``, and asynchronous
  callbacks should call ``self.stop()`` to signal completion.
  
  By default, a new `.IOLoop` is constructed for each test and is available
  as ``self.io_loop``.  This `.IOLoop` should be used in the construction of
  HTTP clients/servers, etc.  If the code being tested requires a
  global `.IOLoop`, subclasses should override `get_new_ioloop` to return it.
  
  The `.IOLoop`'s ``start`` and ``stop`` methods should not be
  called directly.  Instead, use `self.stop <stop>` and `self.wait
  <wait>`.  Arguments passed to ``self.stop`` are returned from
  ``self.wait``.  It is possible to have multiple ``wait``/``stop``
  cycles in the same test.
  
  Example::
  
      # This test uses coroutine style.
      class MyTestCase(AsyncTestCase):
          @tornado.testing.gen_test
          def test_http_fetch(self):
              client = AsyncHTTPClient(self.io_loop)
              response = yield client.fetch("http://www.tornadoweb.org")
              # Test contents of response
              self.assertIn("FriendFeed", response.body)
  
      # This test uses argument passing between self.stop and self.wait.
      class MyTestCase2(AsyncTestCase):
          def test_http_fetch(self):
              client = AsyncHTTPClient(self.io_loop)
              client.fetch("http://www.tornadoweb.org/", self.stop)
              response = self.wait()
              # Test contents of response
              self.assertIn("FriendFeed", response.body)
  
      # This test uses an explicit callback-based style.
      class MyTestCase3(AsyncTestCase):
          def test_http_fetch(self):
              client = AsyncHTTPClient(self.io_loop)
              client.fetch("http://www.tornadoweb.org/", self.handle_fetch)
              self.wait()
  
          def handle_fetch(self, response):
              # Test contents of response (failures and exceptions here
              # will cause self.wait() to throw an exception and end the
              # test).
              # Exceptions thrown here are magically propagated to
              # self.wait() in test_http_fetch() via stack_context.
              self.assertIn("FriendFeed", response.body)
              self.stop()
code: def __init__(self, methodName="runTest"):
      super(AsyncTestCase, self).__init__(methodName)
      self.__stopped = False
      self.__running = False
      self.__failure = None
      self.__stop_args = None
      self.__timeout = None
  
      # It's easy to forget the @gen_test decorator, but if you do
      # the test will silently be ignored because nothing will consume
      # the generator.  Replace the test method with a wrapper that will
      # make sure it's not an undecorated generator.
      setattr(
          self,
          methodName,
          _TestMethodWrapper(getattr(self, methodName)),
      )
  
imports: from __future__ import absolute_import, division, print_function
  from tornado.log import gen_log, app_log
  from tornado.stack_context import ExceptionStackContext
  from tornado.util import raise_exc_info, basestring_type, PY3
  import functools
  import inspect
  import logging
  import os
  import re
  import signal
  import socket
  import sys
label_desc: Use image node_id 1 to create a new AsyncTestCase object from inherited base classes: unittest with example: obj = AsyncTestCase(methodName)