def METHOD_NAME(self):
    # be sure handlers are executed in reverse order
    atexit.register(h1)
    atexit.register(h2)
    atexit.register(h3)
    atexit._run_exitfuncs()
    self.assertEqual(self.stream.getvalue(), "h3\nh2\nh1\n")