@@ -0,0 +1,1933 @@
+import asyncio%0Aimport pytest%0A%0Afrom aiohttp import web, log%0Afrom unittest import mock%0A%0A%0Adef test_app_ctor(loop):%0A    app = web.Application(loop=loop)%0A    assert loop is app.loop%0A    assert app.logger is log.web_logger%0A%0A%0Adef test_app_call(loop):%0A    app = web.Application(loop=loop)%0A    assert app is app()%0A%0A%0Adef test_app_default_loop(loop):%0A    asyncio.set_event_loop(loop)%0A    app = web.Application()%0A    assert loop is app.loop%0A%0A%0A@pytest.mark.run_loop%0Adef test_app_register_on_finish(loop):%0A    app = web.Application(loop=loop)%0A    cb1 = mock.Mock()%0A    cb2 = mock.Mock()%0A    app.register_on_finish(cb1, 1, b=2)%0A    app.register_on_finish(cb2, 2, c=3)%0A    yield from app.finish()%0A    cb1.assert_called_once_with(app, 1, b=2)%0A    cb2.assert_called_once_with(app, 2, c=3)%0A%0A%0A@pytest.mark.run_loop%0Adef test_app_register_coro(loop):%0A    app = web.Application(loop=loop)%0A%0A    fut = asyncio.Future(loop=loop)%0A%0A    @asyncio.coroutine%0A    def cb(app):%0A        yield from asyncio.sleep(0.001, loop=loop)%0A        fut.set_result(123)%0A%0A    app.register_on_finish(cb)%0A    yield from app.finish()%0A    assert fut.done()%0A    assert 123 == fut.result()%0A%0A%0A@pytest.mark.run_loop%0Adef test_app_error_in_finish_callbacks(loop):%0A    app = web.Application(loop=loop)%0A%0A    err = RuntimeError('bad call')%0A    app.register_on_finish(mock.Mock(side_effect=err))%0A    handler = mock.Mock()%0A    loop.set_exception_handler(handler)%0A    yield from app.finish()%0A    exc_info = %7B'exception': err,%0A                'application': app,%0A                'message': 'Error in finish callback'%7D%0A    handler.assert_called_once_with(loop, exc_info)%0A%0A%0Adef test_non_default_router(loop):%0A    router = web.UrlDispatcher()%0A    app = web.Application(loop=loop, router=router)%0A    assert router is app.router%0A%0A    def test_logging(self):%0A        logger = mock.Mock()%0A        app = web.Application(loop=self.loop)%0A        app.logger = logger%0A        self.assertIs(app.logger, logger)%0A

Convert web.Application tests to pytest style