{
    "file_diffs": [
        {
            "old_file_content": "__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')\n\nimport asyncio\nimport binascii\nimport cgi\nimport collections\nimport datetime\nimport http.cookies\nimport io\nimport json\nimport math\nimport time\nimport warnings\n\nimport enum\n\nfrom email.utils import parsedate\nfrom types import MappingProxyType\nfrom urllib.parse import urlsplit, parse_qsl, unquote\n\nfrom . import hdrs\nfrom .helpers import reify\nfrom .multidict import (CIMultiDictProxy,\n                        CIMultiDict,\n                        MultiDictProxy,\n                        MultiDict)\nfrom .protocol import Response as ResponseImpl, HttpVersion10\nfrom .streams import EOF_MARKER\n\n\nsentinel = object()\n\n\nclass HeadersMixin:\n\n    _content_type = None\n    _content_dict = None\n    _stored_content_type = sentinel\n\n    def _parse_content_type(self, raw):\n        self._stored_content_type = raw\n        if raw is None:\n            # default value according to RFC 2616\n            self._content_type = 'application/octet-stream'\n            self._content_dict = {}\n        else:\n            self._content_type, self._content_dict = cgi.parse_header(raw)\n\n    @property\n    def content_type(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of content part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_type\n\n    @property\n    def charset(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of charset part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_dict.get('charset')\n\n    @property\n    def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):\n        \"\"\"The value of Content-Length HTTP header.\"\"\"\n        l = self.headers.get(_CONTENT_LENGTH)\n        if l is None:\n            return None\n        else:\n            return int(l)\n\nFileField = collections.namedtuple('Field', 'name filename file content_type')\n\n\nclass ContentCoding(enum.Enum):\n    # The content codings that we have support for.\n    #\n    # Additional registered codings are listed at:\n    # https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding\n    deflate = 'deflate'\n    gzip = 'gzip'\n    identity = 'identity'\n\n\n############################################################\n# HTTP Request\n############################################################\n\n\nclass Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        return urlsplit(self._path_qs)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)\n\n\n############################################################\n# HTTP Response classes\n############################################################\n\n\nclass StreamResponse(HeadersMixin):\n\n    def __init__(self, *, status=200, reason=None, headers=None):\n        self._body = None\n        self._keep_alive = None\n        self._chunked = False\n        self._chunk_size = None\n        self._compression = False\n        self._compression_force = False\n        self._headers = CIMultiDict()\n        self._cookies = http.cookies.SimpleCookie()\n        self.set_status(status, reason)\n\n        self._req = None\n        self._resp_impl = None\n        self._eof_sent = False\n\n        if headers is not None:\n            self._headers.extend(headers)\n\n    def _copy_cookies(self):\n        for cookie in self._cookies.values():\n            value = cookie.output(header='')[1:]\n            self.headers.add(hdrs.SET_COOKIE, value)\n\n    @property\n    def started(self):\n        return self._resp_impl is not None\n\n    @property\n    def status(self):\n        return self._status\n\n    @property\n    def chunked(self):\n        return self._chunked\n\n    @property\n    def compression(self):\n        return self._compression\n\n    @property\n    def reason(self):\n        return self._reason\n\n    def set_status(self, status, reason=None):\n        self._status = int(status)\n        if reason is None:\n            reason = ResponseImpl.calc_reason(status)\n        self._reason = reason\n\n    @property\n    def keep_alive(self):\n        return self._keep_alive\n\n    def force_close(self):\n        self._keep_alive = False\n\n    def enable_chunked_encoding(self, chunk_size=None):\n        \"\"\"Enables automatic chunked transfer encoding.\"\"\"\n        self._chunked = True\n        self._chunk_size = chunk_size\n\n    def enable_compression(self, force=None):\n        \"\"\"Enables response compression encoding.\"\"\"\n        # Backwards compatibility for when force was a bool <0.17.\n        if type(force) == bool:\n            force = ContentCoding.deflate if force else ContentCoding.identity\n\n        self._compression = True\n        self._compression_force = force\n\n    @property\n    def headers(self):\n        return self._headers\n\n    @property\n    def cookies(self):\n        return self._cookies\n\n    def set_cookie(self, name, value, *, expires=None,\n                   domain=None, max_age=None, path='/',\n                   secure=None, httponly=None, version=None):\n        \"\"\"Set or update response cookie.\n\n        Sets new cookie or updates existent with new value.\n        Also updates only those params which are not None.\n        \"\"\"\n\n        old = self._cookies.get(name)\n        if old is not None and old.coded_value == '':\n            # deleted cookie\n            self._cookies.pop(name, None)\n\n        self._cookies[name] = value\n        c = self._cookies[name]\n        if expires is not None:\n            c['expires'] = expires\n        if domain is not None:\n            c['domain'] = domain\n        if max_age is not None:\n            c['max-age'] = max_age\n        if path is not None:\n            c['path'] = path\n        if secure is not None:\n            c['secure'] = secure\n        if httponly is not None:\n            c['httponly'] = httponly\n        if version is not None:\n            c['version'] = version\n\n    def del_cookie(self, name, *, domain=None, path='/'):\n        \"\"\"Delete cookie.\n\n        Creates new empty expired cookie.\n        \"\"\"\n        # TODO: do we need domain/path here?\n        self._cookies.pop(name, None)\n        self.set_cookie(name, '', max_age=0, domain=domain, path=path)\n\n    @property\n    def content_length(self):\n        # Just a placeholder for adding setter\n        return super().content_length\n\n    @content_length.setter\n    def content_length(self, value):\n        if value is not None:\n            value = int(value)\n            # TODO: raise error if chunked enabled\n            self.headers[hdrs.CONTENT_LENGTH] = str(value)\n        else:\n            self.headers.pop(hdrs.CONTENT_LENGTH, None)\n\n    @property\n    def content_type(self):\n        # Just a placeholder for adding setter\n        return super().content_type\n\n    @content_type.setter\n    def content_type(self, value):\n        self.content_type  # read header values if needed\n        self._content_type = str(value)\n        self._generate_content_type_header()\n\n    @property\n    def charset(self):\n        # Just a placeholder for adding setter\n        return super().charset\n\n    @charset.setter\n    def charset(self, value):\n        ctype = self.content_type  # read header values if needed\n        if ctype == 'application/octet-stream':\n            raise RuntimeError(\"Setting charset for application/octet-stream \"\n                               \"doesn't make sense, setup content_type first\")\n        if value is None:\n            self._content_dict.pop('charset', None)\n        else:\n            self._content_dict['charset'] = str(value).lower()\n        self._generate_content_type_header()\n\n    @property\n    def last_modified(self, _LAST_MODIFIED=hdrs.LAST_MODIFIED):\n        \"\"\"The value of Last-Modified HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_LAST_MODIFIED)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @last_modified.setter\n    def last_modified(self, value):\n        if value is None:\n            if hdrs.LAST_MODIFIED in self.headers:\n                del self.headers[hdrs.LAST_MODIFIED]\n        elif isinstance(value, (int, float)):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", time.gmtime(math.ceil(value)))\n        elif isinstance(value, datetime.datetime):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", value.utctimetuple())\n        elif isinstance(value, str):\n            self.headers[hdrs.LAST_MODIFIED] = value\n\n    def _generate_content_type_header(self, CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        params = '; '.join(\"%s=%s\" % i for i in self._content_dict.items())\n        if params:\n            ctype = self._content_type + '; ' + params\n        else:\n            ctype = self._content_type\n        self.headers[CONTENT_TYPE] = ctype\n\n    def _start_pre_check(self, request):\n        if self._resp_impl is not None:\n            if self._req is not request:\n                raise RuntimeError(\n                    'Response has been started with different request.')\n            else:\n                return self._resp_impl\n        else:\n            return None\n\n    def _start_compression(self, request):\n        def start(coding):\n            if coding != ContentCoding.identity:\n                self.headers[hdrs.CONTENT_ENCODING] = coding.value\n                self._resp_impl.add_compression_filter(coding.value)\n                self.content_length = None\n\n        if self._compression_force:\n            start(self._compression_force)\n        else:\n            accept_encoding = request.headers.get(\n                hdrs.ACCEPT_ENCODING, '').lower()\n            for coding in ContentCoding:\n                if coding.value in accept_encoding:\n                    start(coding)\n                    return\n\n    def start(self, request):\n        resp_impl = self._start_pre_check(request)\n        if resp_impl is not None:\n            return resp_impl\n\n        self._req = request\n        keep_alive = self._keep_alive\n        if keep_alive is None:\n            keep_alive = request.keep_alive\n        self._keep_alive = keep_alive\n\n        resp_impl = self._resp_impl = ResponseImpl(\n            request._writer,\n            self._status,\n            request.version,\n            not keep_alive,\n            self._reason)\n\n        self._copy_cookies()\n\n        if self._compression:\n            self._start_compression(request)\n\n        if self._chunked:\n            resp_impl.enable_chunked_encoding()\n            if self._chunk_size:\n                resp_impl.add_chunking_filter(self._chunk_size)\n\n        headers = self.headers.items()\n        for key, val in headers:\n            resp_impl.add_header(key, val)\n\n        resp_impl.send_headers()\n        return resp_impl\n\n    def write(self, data):\n        assert isinstance(data, (bytes, bytearray, memoryview)), \\\n            'data argument must be byte-ish (%r)' % type(data)\n\n        if self._eof_sent:\n            raise RuntimeError(\"Cannot call write() after write_eof()\")\n        if self._resp_impl is None:\n            raise RuntimeError(\"Cannot call write() before start()\")\n\n        if data:\n            return self._resp_impl.write(data)\n        else:\n            return ()\n\n    @asyncio.coroutine\n    def drain(self):\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n        yield from self._resp_impl.transport.drain()\n\n    @asyncio.coroutine\n    def write_eof(self):\n        if self._eof_sent:\n            return\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n\n        yield from self._resp_impl.write_eof()\n        self._eof_sent = True\n\n    def __repr__(self):\n        if self.started:\n            info = \"{} {} \".format(self._req.method, self._req.path)\n        else:\n            info = \"not started\"\n        return \"<{} {} {}>\".format(self.__class__.__name__,\n                                   self.reason, info)\n\n\nclass Response(StreamResponse):\n\n    def __init__(self, *, body=None, status=200,\n                 reason=None, text=None, headers=None, content_type=None):\n        super().__init__(status=status, reason=reason, headers=headers)\n\n        if body is not None and text is not None:\n            raise ValueError(\"body and text are not allowed together.\")\n\n        if text is not None:\n            if hdrs.CONTENT_TYPE not in self.headers:\n                # fast path for filling headers\n                if not isinstance(text, str):\n                    raise TypeError('text argument must be str (%r)' %\n                                    type(text))\n                if content_type is None:\n                    content_type = 'text/plain'\n                self.headers[hdrs.CONTENT_TYPE] = (\n                    content_type + '; charset=utf-8')\n                self._content_type = content_type\n                self._content_dict = {'charset': 'utf-8'}\n                self.body = text.encode('utf-8')\n            else:\n                self.text = text\n        else:\n            if content_type:\n                self.content_type = content_type\n            if body is not None:\n                self.body = body\n            else:\n                self.body = None\n\n    @property\n    def body(self):\n        return self._body\n\n    @body.setter\n    def body(self, body):\n        if body is not None and not isinstance(body, bytes):\n            raise TypeError('body argument must be bytes (%r)' % type(body))\n        self._body = body\n        if body is not None:\n            self.content_length = len(body)\n        else:\n            self.content_length = 0\n\n    @property\n    def text(self):\n        if self._body is None:\n            return None\n        return self._body.decode(self.charset or 'utf-8')\n\n    @text.setter\n    def text(self, text):\n        if text is not None and not isinstance(text, str):\n            raise TypeError('text argument must be str (%r)' % type(text))\n\n        if self.content_type == 'application/octet-stream':\n            self.content_type = 'text/plain'\n        if self.charset is None:\n            self.charset = 'utf-8'\n\n        self.body = text.encode(self.charset)\n\n    @asyncio.coroutine\n    def write_eof(self):\n        body = self._body\n        if body is not None:\n            self.write(body)\n        yield from super().write_eof()\n",
            "new_file_content": "__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')\n\nimport asyncio\nimport binascii\nimport cgi\nimport collections\nimport datetime\nimport http.cookies\nimport io\nimport json\nimport math\nimport time\nimport warnings\n\nimport enum\n\nfrom email.utils import parsedate\nfrom types import MappingProxyType\nfrom urllib.parse import urlsplit, parse_qsl, unquote\n\nfrom . import hdrs\nfrom .helpers import reify\nfrom .multidict import (CIMultiDictProxy,\n                        CIMultiDict,\n                        MultiDictProxy,\n                        MultiDict)\nfrom .protocol import Response as ResponseImpl, HttpVersion10\nfrom .streams import EOF_MARKER\n\n\nsentinel = object()\n\n\nclass HeadersMixin:\n\n    _content_type = None\n    _content_dict = None\n    _stored_content_type = sentinel\n\n    def _parse_content_type(self, raw):\n        self._stored_content_type = raw\n        if raw is None:\n            # default value according to RFC 2616\n            self._content_type = 'application/octet-stream'\n            self._content_dict = {}\n        else:\n            self._content_type, self._content_dict = cgi.parse_header(raw)\n\n    @property\n    def content_type(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of content part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_type\n\n    @property\n    def charset(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of charset part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_dict.get('charset')\n\n    @property\n    def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):\n        \"\"\"The value of Content-Length HTTP header.\"\"\"\n        l = self.headers.get(_CONTENT_LENGTH)\n        if l is None:\n            return None\n        else:\n            return int(l)\n\nFileField = collections.namedtuple('Field', 'name filename file content_type')\n\n\nclass ContentCoding(enum.Enum):\n    # The content codings that we have support for.\n    #\n    # Additional registered codings are listed at:\n    # https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding\n    deflate = 'deflate'\n    gzip = 'gzip'\n    identity = 'identity'\n\n\n############################################################\n# HTTP Request\n############################################################\n\n\nclass Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        url = '{}://{}{}'.format(self.scheme, self.host, self._path_qs)\n        return urlsplit(url)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)\n\n\n############################################################\n# HTTP Response classes\n############################################################\n\n\nclass StreamResponse(HeadersMixin):\n\n    def __init__(self, *, status=200, reason=None, headers=None):\n        self._body = None\n        self._keep_alive = None\n        self._chunked = False\n        self._chunk_size = None\n        self._compression = False\n        self._compression_force = False\n        self._headers = CIMultiDict()\n        self._cookies = http.cookies.SimpleCookie()\n        self.set_status(status, reason)\n\n        self._req = None\n        self._resp_impl = None\n        self._eof_sent = False\n\n        if headers is not None:\n            self._headers.extend(headers)\n\n    def _copy_cookies(self):\n        for cookie in self._cookies.values():\n            value = cookie.output(header='')[1:]\n            self.headers.add(hdrs.SET_COOKIE, value)\n\n    @property\n    def started(self):\n        return self._resp_impl is not None\n\n    @property\n    def status(self):\n        return self._status\n\n    @property\n    def chunked(self):\n        return self._chunked\n\n    @property\n    def compression(self):\n        return self._compression\n\n    @property\n    def reason(self):\n        return self._reason\n\n    def set_status(self, status, reason=None):\n        self._status = int(status)\n        if reason is None:\n            reason = ResponseImpl.calc_reason(status)\n        self._reason = reason\n\n    @property\n    def keep_alive(self):\n        return self._keep_alive\n\n    def force_close(self):\n        self._keep_alive = False\n\n    def enable_chunked_encoding(self, chunk_size=None):\n        \"\"\"Enables automatic chunked transfer encoding.\"\"\"\n        self._chunked = True\n        self._chunk_size = chunk_size\n\n    def enable_compression(self, force=None):\n        \"\"\"Enables response compression encoding.\"\"\"\n        # Backwards compatibility for when force was a bool <0.17.\n        if type(force) == bool:\n            force = ContentCoding.deflate if force else ContentCoding.identity\n\n        self._compression = True\n        self._compression_force = force\n\n    @property\n    def headers(self):\n        return self._headers\n\n    @property\n    def cookies(self):\n        return self._cookies\n\n    def set_cookie(self, name, value, *, expires=None,\n                   domain=None, max_age=None, path='/',\n                   secure=None, httponly=None, version=None):\n        \"\"\"Set or update response cookie.\n\n        Sets new cookie or updates existent with new value.\n        Also updates only those params which are not None.\n        \"\"\"\n\n        old = self._cookies.get(name)\n        if old is not None and old.coded_value == '':\n            # deleted cookie\n            self._cookies.pop(name, None)\n\n        self._cookies[name] = value\n        c = self._cookies[name]\n        if expires is not None:\n            c['expires'] = expires\n        if domain is not None:\n            c['domain'] = domain\n        if max_age is not None:\n            c['max-age'] = max_age\n        if path is not None:\n            c['path'] = path\n        if secure is not None:\n            c['secure'] = secure\n        if httponly is not None:\n            c['httponly'] = httponly\n        if version is not None:\n            c['version'] = version\n\n    def del_cookie(self, name, *, domain=None, path='/'):\n        \"\"\"Delete cookie.\n\n        Creates new empty expired cookie.\n        \"\"\"\n        # TODO: do we need domain/path here?\n        self._cookies.pop(name, None)\n        self.set_cookie(name, '', max_age=0, domain=domain, path=path)\n\n    @property\n    def content_length(self):\n        # Just a placeholder for adding setter\n        return super().content_length\n\n    @content_length.setter\n    def content_length(self, value):\n        if value is not None:\n            value = int(value)\n            # TODO: raise error if chunked enabled\n            self.headers[hdrs.CONTENT_LENGTH] = str(value)\n        else:\n            self.headers.pop(hdrs.CONTENT_LENGTH, None)\n\n    @property\n    def content_type(self):\n        # Just a placeholder for adding setter\n        return super().content_type\n\n    @content_type.setter\n    def content_type(self, value):\n        self.content_type  # read header values if needed\n        self._content_type = str(value)\n        self._generate_content_type_header()\n\n    @property\n    def charset(self):\n        # Just a placeholder for adding setter\n        return super().charset\n\n    @charset.setter\n    def charset(self, value):\n        ctype = self.content_type  # read header values if needed\n        if ctype == 'application/octet-stream':\n            raise RuntimeError(\"Setting charset for application/octet-stream \"\n                               \"doesn't make sense, setup content_type first\")\n        if value is None:\n            self._content_dict.pop('charset', None)\n        else:\n            self._content_dict['charset'] = str(value).lower()\n        self._generate_content_type_header()\n\n    @property\n    def last_modified(self, _LAST_MODIFIED=hdrs.LAST_MODIFIED):\n        \"\"\"The value of Last-Modified HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_LAST_MODIFIED)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @last_modified.setter\n    def last_modified(self, value):\n        if value is None:\n            if hdrs.LAST_MODIFIED in self.headers:\n                del self.headers[hdrs.LAST_MODIFIED]\n        elif isinstance(value, (int, float)):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", time.gmtime(math.ceil(value)))\n        elif isinstance(value, datetime.datetime):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", value.utctimetuple())\n        elif isinstance(value, str):\n            self.headers[hdrs.LAST_MODIFIED] = value\n\n    def _generate_content_type_header(self, CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        params = '; '.join(\"%s=%s\" % i for i in self._content_dict.items())\n        if params:\n            ctype = self._content_type + '; ' + params\n        else:\n            ctype = self._content_type\n        self.headers[CONTENT_TYPE] = ctype\n\n    def _start_pre_check(self, request):\n        if self._resp_impl is not None:\n            if self._req is not request:\n                raise RuntimeError(\n                    'Response has been started with different request.')\n            else:\n                return self._resp_impl\n        else:\n            return None\n\n    def _start_compression(self, request):\n        def start(coding):\n            if coding != ContentCoding.identity:\n                self.headers[hdrs.CONTENT_ENCODING] = coding.value\n                self._resp_impl.add_compression_filter(coding.value)\n                self.content_length = None\n\n        if self._compression_force:\n            start(self._compression_force)\n        else:\n            accept_encoding = request.headers.get(\n                hdrs.ACCEPT_ENCODING, '').lower()\n            for coding in ContentCoding:\n                if coding.value in accept_encoding:\n                    start(coding)\n                    return\n\n    def start(self, request):\n        resp_impl = self._start_pre_check(request)\n        if resp_impl is not None:\n            return resp_impl\n\n        self._req = request\n        keep_alive = self._keep_alive\n        if keep_alive is None:\n            keep_alive = request.keep_alive\n        self._keep_alive = keep_alive\n\n        resp_impl = self._resp_impl = ResponseImpl(\n            request._writer,\n            self._status,\n            request.version,\n            not keep_alive,\n            self._reason)\n\n        self._copy_cookies()\n\n        if self._compression:\n            self._start_compression(request)\n\n        if self._chunked:\n            resp_impl.enable_chunked_encoding()\n            if self._chunk_size:\n                resp_impl.add_chunking_filter(self._chunk_size)\n\n        headers = self.headers.items()\n        for key, val in headers:\n            resp_impl.add_header(key, val)\n\n        resp_impl.send_headers()\n        return resp_impl\n\n    def write(self, data):\n        assert isinstance(data, (bytes, bytearray, memoryview)), \\\n            'data argument must be byte-ish (%r)' % type(data)\n\n        if self._eof_sent:\n            raise RuntimeError(\"Cannot call write() after write_eof()\")\n        if self._resp_impl is None:\n            raise RuntimeError(\"Cannot call write() before start()\")\n\n        if data:\n            return self._resp_impl.write(data)\n        else:\n            return ()\n\n    @asyncio.coroutine\n    def drain(self):\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n        yield from self._resp_impl.transport.drain()\n\n    @asyncio.coroutine\n    def write_eof(self):\n        if self._eof_sent:\n            return\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n\n        yield from self._resp_impl.write_eof()\n        self._eof_sent = True\n\n    def __repr__(self):\n        if self.started:\n            info = \"{} {} \".format(self._req.method, self._req.path)\n        else:\n            info = \"not started\"\n        return \"<{} {} {}>\".format(self.__class__.__name__,\n                                   self.reason, info)\n\n\nclass Response(StreamResponse):\n\n    def __init__(self, *, body=None, status=200,\n                 reason=None, text=None, headers=None, content_type=None):\n        super().__init__(status=status, reason=reason, headers=headers)\n\n        if body is not None and text is not None:\n            raise ValueError(\"body and text are not allowed together.\")\n\n        if text is not None:\n            if hdrs.CONTENT_TYPE not in self.headers:\n                # fast path for filling headers\n                if not isinstance(text, str):\n                    raise TypeError('text argument must be str (%r)' %\n                                    type(text))\n                if content_type is None:\n                    content_type = 'text/plain'\n                self.headers[hdrs.CONTENT_TYPE] = (\n                    content_type + '; charset=utf-8')\n                self._content_type = content_type\n                self._content_dict = {'charset': 'utf-8'}\n                self.body = text.encode('utf-8')\n            else:\n                self.text = text\n        else:\n            if content_type:\n                self.content_type = content_type\n            if body is not None:\n                self.body = body\n            else:\n                self.body = None\n\n    @property\n    def body(self):\n        return self._body\n\n    @body.setter\n    def body(self, body):\n        if body is not None and not isinstance(body, bytes):\n            raise TypeError('body argument must be bytes (%r)' % type(body))\n        self._body = body\n        if body is not None:\n            self.content_length = len(body)\n        else:\n            self.content_length = 0\n\n    @property\n    def text(self):\n        if self._body is None:\n            return None\n        return self._body.decode(self.charset or 'utf-8')\n\n    @text.setter\n    def text(self, text):\n        if text is not None and not isinstance(text, str):\n            raise TypeError('text argument must be str (%r)' % type(text))\n\n        if self.content_type == 'application/octet-stream':\n            self.content_type = 'text/plain'\n        if self.charset is None:\n            self.charset = 'utf-8'\n\n        self.body = text.encode(self.charset)\n\n    @asyncio.coroutine\n    def write_eof(self):\n        body = self._body\n        if body is not None:\n            self.write(body)\n        yield from super().write_eof()\n",
            "header": {
                "file": {
                    "path": "aiohttp/web_reqrep.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "6f3e566c",
                "new_commit_hash": "c3e8abc4",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/aiohttp/web_reqrep.py"
            },
            "plus_file": {
                "path": "b/aiohttp/web_reqrep.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 173,
                            "length": 7
                        },
                        "new_range": {
                            "start": 173,
                            "length": 8
                        },
                        "section": "class Request(dict, HeadersMixin):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @reify",
                                "type": "context"
                            },
                            {
                                "content": "    def _splitted_path(self):",
                                "type": "context"
                            },
                            {
                                "content": "        return urlsplit(self._path_qs)",
                                "type": "deleted"
                            },
                            {
                                "content": "        url = '{}://{}{}'.format(self.scheme, self.host, self._path_qs)",
                                "type": "added"
                            },
                            {
                                "content": "        return urlsplit(url)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @property",
                                "type": "context"
                            },
                            {
                                "content": "    def raw_path(self):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "aiohttp/web_reqrep.py",
                            "type": "method",
                            "name": "Request._splitted_path",
                            "content": "class Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        return urlsplit(self._path_qs)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 175,
                            "end_lineno": 176,
                            "parent": {
                                "file_name": "aiohttp/web_reqrep.py",
                                "type": "class",
                                "name": "Request",
                                "content": "class Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        return urlsplit(self._path_qs)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 92,
                                "end_lineno": 392,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "aiohttp/web_reqrep.py",
                            "type": "class",
                            "name": "Request",
                            "content": "class Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        return urlsplit(self._path_qs)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 92,
                            "end_lineno": 392,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import asyncio\nimport unittest\nfrom unittest import mock\n\nfrom aiohttp import web, log\nfrom aiohttp.multidict import CIMultiDict\nfrom aiohttp.protocol import HttpVersion11, RawRequestMessage\n\n\nclass TestWeb(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def test_handler_returns_not_response(self):\n        app = web.Application(loop=self.loop)\n\n        def handler(request):\n            return 'abc'\n\n        app.router.add_route('GET', '/', handler)\n        h = app.make_handler()()\n        message = RawRequestMessage('GET', '/', HttpVersion11,\n                                    CIMultiDict(), False, False)\n        payload = mock.Mock()\n\n        with self.assertRaises(AssertionError):\n            self.loop.run_until_complete(h.handle_request(message, payload))\n\n    def test_app_ctor(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(self.loop, app.loop)\n        self.assertIs(app.logger, log.web_logger)\n\n    def test_app_call(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(app, app())\n\n    def test_app_default_loop(self):\n        asyncio.set_event_loop(self.loop)\n        app = web.Application()\n        self.assertIs(self.loop, app.loop)\n\n    def test_app_register_on_finish(self):\n        app = web.Application(loop=self.loop)\n        cb1 = mock.Mock()\n        cb2 = mock.Mock()\n        app.register_on_finish(cb1, 1, b=2)\n        app.register_on_finish(cb2, 2, c=3)\n        self.loop.run_until_complete(app.finish())\n        cb1.assert_called_once_with(app, 1, b=2)\n        cb2.assert_called_once_with(app, 2, c=3)\n\n    def test_app_register_coro(self):\n        app = web.Application(loop=self.loop)\n\n        fut = asyncio.Future(loop=self.loop)\n\n        @asyncio.coroutine\n        def cb(app):\n            yield from asyncio.sleep(0.001, loop=self.loop)\n            fut.set_result(123)\n\n        app.register_on_finish(cb)\n        self.loop.run_until_complete(app.finish())\n        self.assertTrue(fut.done())\n        self.assertEqual(123, fut.result())\n\n    def test_app_error_in_finish_callbacks(self):\n        app = web.Application(loop=self.loop)\n\n        err = RuntimeError('bad call')\n        app.register_on_finish(mock.Mock(side_effect=err))\n        handler = mock.Mock()\n        self.loop.set_exception_handler(handler)\n        self.loop.run_until_complete(app.finish())\n        exc_info = {'exception': err,\n                    'application': app,\n                    'message': 'Error in finish callback'}\n        handler.assert_called_once_with(self.loop, exc_info)\n\n    def test_non_default_router(self):\n        router = web.UrlDispatcher()\n        app = web.Application(loop=self.loop, router=router)\n        self.assertIs(router, app.router)\n\n    def test_logging(self):\n        logger = mock.Mock()\n        app = web.Application(loop=self.loop)\n        app.logger = logger\n        self.assertIs(app.logger, logger)\n\n\nclass TestRequestHandlerFactory(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def test_repr(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        handler = manager()\n\n        self.assertEqual(\n            '<RequestHandler none:none disconnected>', repr(handler))\n\n        handler.transport = object()\n        handler._meth = 'GET'\n        handler._path = '/index.html'\n        self.assertEqual(\n            '<RequestHandler GET:/index.html connected>', repr(handler))\n\n    def test_connections(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        self.assertEqual(manager.connections, [])\n\n        handler = object()\n        transport = object()\n        manager.connection_made(handler, transport)\n        self.assertEqual(manager.connections, [handler])\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n\n    def test_finish_connection_no_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections())\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=None)\n        transport.close.assert_called_with()\n\n    def test_finish_connection_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections(timeout=0.1))\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=0.09)\n        transport.close.assert_called_with()\n",
            "new_file_content": "import asyncio\nimport unittest\nfrom unittest import mock\n\nfrom aiohttp import web, log\nfrom aiohttp.multidict import CIMultiDict\nfrom aiohttp.protocol import HttpVersion11, RawRequestMessage\n\n\nclass TestWeb(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    @unittest.skip('moved to test_web_functional')\n    def test_handler_returns_not_response(self):\n        app = web.Application(loop=self.loop)\n\n        def handler(request):\n            return 'abc'\n\n        app.router.add_route('GET', '/', handler)\n        h = app.make_handler()()\n        message = RawRequestMessage('GET', '/', HttpVersion11,\n                                    CIMultiDict(), False, False)\n        payload = mock.Mock()\n\n        with self.assertRaises(AssertionError):\n            self.loop.run_until_complete(h.handle_request(message, payload))\n\n    def test_app_ctor(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(self.loop, app.loop)\n        self.assertIs(app.logger, log.web_logger)\n\n    def test_app_call(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(app, app())\n\n    def test_app_default_loop(self):\n        asyncio.set_event_loop(self.loop)\n        app = web.Application()\n        self.assertIs(self.loop, app.loop)\n\n    def test_app_register_on_finish(self):\n        app = web.Application(loop=self.loop)\n        cb1 = mock.Mock()\n        cb2 = mock.Mock()\n        app.register_on_finish(cb1, 1, b=2)\n        app.register_on_finish(cb2, 2, c=3)\n        self.loop.run_until_complete(app.finish())\n        cb1.assert_called_once_with(app, 1, b=2)\n        cb2.assert_called_once_with(app, 2, c=3)\n\n    def test_app_register_coro(self):\n        app = web.Application(loop=self.loop)\n\n        fut = asyncio.Future(loop=self.loop)\n\n        @asyncio.coroutine\n        def cb(app):\n            yield from asyncio.sleep(0.001, loop=self.loop)\n            fut.set_result(123)\n\n        app.register_on_finish(cb)\n        self.loop.run_until_complete(app.finish())\n        self.assertTrue(fut.done())\n        self.assertEqual(123, fut.result())\n\n    def test_app_error_in_finish_callbacks(self):\n        app = web.Application(loop=self.loop)\n\n        err = RuntimeError('bad call')\n        app.register_on_finish(mock.Mock(side_effect=err))\n        handler = mock.Mock()\n        self.loop.set_exception_handler(handler)\n        self.loop.run_until_complete(app.finish())\n        exc_info = {'exception': err,\n                    'application': app,\n                    'message': 'Error in finish callback'}\n        handler.assert_called_once_with(self.loop, exc_info)\n\n    def test_non_default_router(self):\n        router = web.UrlDispatcher()\n        app = web.Application(loop=self.loop, router=router)\n        self.assertIs(router, app.router)\n\n    def test_logging(self):\n        logger = mock.Mock()\n        app = web.Application(loop=self.loop)\n        app.logger = logger\n        self.assertIs(app.logger, logger)\n\n\nclass TestRequestHandlerFactory(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def test_repr(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        handler = manager()\n\n        self.assertEqual(\n            '<RequestHandler none:none disconnected>', repr(handler))\n\n        handler.transport = object()\n        handler._meth = 'GET'\n        handler._path = '/index.html'\n        self.assertEqual(\n            '<RequestHandler GET:/index.html connected>', repr(handler))\n\n    def test_connections(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        self.assertEqual(manager.connections, [])\n\n        handler = object()\n        transport = object()\n        manager.connection_made(handler, transport)\n        self.assertEqual(manager.connections, [handler])\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n\n    def test_finish_connection_no_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections())\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=None)\n        transport.close.assert_called_with()\n\n    def test_finish_connection_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections(timeout=0.1))\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=0.09)\n        transport.close.assert_called_with()\n",
            "header": {
                "file": {
                    "path": "tests/test_web.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "b7626d80",
                "new_commit_hash": "3968eab1",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/tests/test_web.py"
            },
            "plus_file": {
                "path": "b/tests/test_web.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 16,
                            "length": 6
                        },
                        "new_range": {
                            "start": 16,
                            "length": 7
                        },
                        "section": "class TestWeb(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    def tearDown(self):",
                                "type": "context"
                            },
                            {
                                "content": "        self.loop.close()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @unittest.skip('moved to test_web_functional')",
                                "type": "added"
                            },
                            {
                                "content": "    def test_handler_returns_not_response(self):",
                                "type": "context"
                            },
                            {
                                "content": "        app = web.Application(loop=self.loop)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "tests/test_web.py",
                            "type": "class",
                            "name": "TestWeb",
                            "content": "class TestWeb(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    @unittest.skip('moved to test_web_functional')\n    def test_handler_returns_not_response(self):\n        app = web.Application(loop=self.loop)\n\n        def handler(request):\n            return 'abc'\n\n        app.router.add_route('GET', '/', handler)\n        h = app.make_handler()()\n        message = RawRequestMessage('GET', '/', HttpVersion11,\n                                    CIMultiDict(), False, False)\n        payload = mock.Mock()\n\n        with self.assertRaises(AssertionError):\n            self.loop.run_until_complete(h.handle_request(message, payload))\n\n    def test_app_ctor(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(self.loop, app.loop)\n        self.assertIs(app.logger, log.web_logger)\n\n    def test_app_call(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(app, app())\n\n    def test_app_default_loop(self):\n        asyncio.set_event_loop(self.loop)\n        app = web.Application()\n        self.assertIs(self.loop, app.loop)\n\n    def test_app_register_on_finish(self):\n        app = web.Application(loop=self.loop)\n        cb1 = mock.Mock()\n        cb2 = mock.Mock()\n        app.register_on_finish(cb1, 1, b=2)\n        app.register_on_finish(cb2, 2, c=3)\n        self.loop.run_until_complete(app.finish())\n        cb1.assert_called_once_with(app, 1, b=2)\n        cb2.assert_called_once_with(app, 2, c=3)\n\n    def test_app_register_coro(self):\n        app = web.Application(loop=self.loop)\n\n        fut = asyncio.Future(loop=self.loop)\n\n        @asyncio.coroutine\n        def cb(app):\n            yield from asyncio.sleep(0.001, loop=self.loop)\n            fut.set_result(123)\n\n        app.register_on_finish(cb)\n        self.loop.run_until_complete(app.finish())\n        self.assertTrue(fut.done())\n        self.assertEqual(123, fut.result())\n\n    def test_app_error_in_finish_callbacks(self):\n        app = web.Application(loop=self.loop)\n\n        err = RuntimeError('bad call')\n        app.register_on_finish(mock.Mock(side_effect=err))\n        handler = mock.Mock()\n        self.loop.set_exception_handler(handler)\n        self.loop.run_until_complete(app.finish())\n        exc_info = {'exception': err,\n                    'application': app,\n                    'message': 'Error in finish callback'}\n        handler.assert_called_once_with(self.loop, exc_info)\n\n    def test_non_default_router(self):\n        router = web.UrlDispatcher()\n        app = web.Application(loop=self.loop, router=router)\n        self.assertIs(router, app.router)\n\n    def test_logging(self):\n        logger = mock.Mock()\n        app = web.Application(loop=self.loop)\n        app.logger = logger\n        self.assertIs(app.logger, logger)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 10,
                            "end_lineno": 96,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import asyncio\nimport json\nimport os.path\nimport socket\nimport unittest\nfrom aiohttp import log, web, request, FormData, ClientSession\nfrom aiohttp.multidict import MultiDict\nfrom aiohttp.protocol import HttpVersion, HttpVersion10, HttpVersion11\nfrom aiohttp.streams import EOF_MARKER\n\n\nclass TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n",
            "new_file_content": "import asyncio\nimport json\nimport os.path\nimport socket\nimport unittest\nfrom aiohttp import log, web, request, FormData, ClientSession\nfrom aiohttp.multidict import MultiDict\nfrom aiohttp.protocol import HttpVersion, HttpVersion10, HttpVersion11\nfrom aiohttp.streams import EOF_MARKER\n\n\nclass TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_handler_returns_not_response(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n",
            "header": {
                "file": {
                    "path": "tests/test_web_functional.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "a4bae2d9",
                "new_commit_hash": "01ca86bc",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/tests/test_web_functional.py"
            },
            "plus_file": {
                "path": "b/tests/test_web_functional.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 62,
                            "length": 6
                        },
                        "new_range": {
                            "start": 62,
                            "length": 20
                        },
                        "section": "class TestWebFunctional(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        self.loop.run_until_complete(go())",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_handler_returns_not_response(self):",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        @asyncio.coroutine",
                                "type": "added"
                            },
                            {
                                "content": "        def handler(request):",
                                "type": "added"
                            },
                            {
                                "content": "            return 'abc'",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        @asyncio.coroutine",
                                "type": "added"
                            },
                            {
                                "content": "        def go():",
                                "type": "added"
                            },
                            {
                                "content": "            _, _, url = yield from self.create_server('GET', '/', handler)",
                                "type": "added"
                            },
                            {
                                "content": "            resp = yield from request('GET', url, loop=self.loop)",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertEqual(500, resp.status)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.loop.run_until_complete(go())",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_post_form(self):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        @asyncio.coroutine",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "tests/test_web_functional.py",
                            "type": "class",
                            "name": "TestWebFunctional",
                            "content": "class TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_handler_returns_not_response(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 12,
                            "end_lineno": 923,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "tests/test_web_functional.py",
                            "type": "method",
                            "name": "TestWebFunctional.test_handler_returns_not_response",
                            "content": "class TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_handler_returns_not_response(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 65,
                            "end_lineno": 77,
                            "parent": {
                                "file_name": "tests/test_web_functional.py",
                                "type": "class",
                                "name": "TestWebFunctional",
                                "content": "class TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_handler_returns_not_response(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 12,
                                "end_lineno": 923,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import asyncio\nimport unittest\nfrom unittest import mock\nfrom aiohttp.web import Request\nfrom aiohttp.multidict import MultiDict, CIMultiDict\nfrom aiohttp.protocol import HttpVersion\nfrom aiohttp.protocol import RawRequestMessage\n\n\nclass TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)\n",
            "new_file_content": "import asyncio\nimport unittest\nfrom unittest import mock\nfrom aiohttp.web import Request\nfrom aiohttp.multidict import MultiDict, CIMultiDict\nfrom aiohttp.protocol import HttpVersion\nfrom aiohttp.protocol import RawRequestMessage\n\n\nclass TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n        self.assertEqual('//foo/', req.path)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)\n",
            "header": {
                "file": {
                    "path": "tests/test_web_request.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "2dc3bf9b",
                "new_commit_hash": "60c77bf3",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/tests/test_web_request.py"
            },
            "plus_file": {
                "path": "b/tests/test_web_request.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 64,
                            "length": 6
                        },
                        "new_range": {
                            "start": 64,
                            "length": 10
                        },
                        "section": "class TestWebRequest(unittest.TestCase):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertIs(self.transport, req.transport)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTrue(req.keep_alive)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_doubleslashes(self):",
                                "type": "added"
                            },
                            {
                                "content": "        req = self.make_request('GET', '//foo/')",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual('//foo/', req.path)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_POST(self):",
                                "type": "context"
                            },
                            {
                                "content": "        req = self.make_request('POST', '/')",
                                "type": "context"
                            },
                            {
                                "content": "        with self.assertRaises(RuntimeError):",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "tests/test_web_request.py",
                            "type": "class",
                            "name": "TestWebRequest",
                            "content": "class TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n        self.assertEqual('//foo/', req.path)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 10,
                            "end_lineno": 212,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "tests/test_web_request.py",
                            "type": "method",
                            "name": "TestWebRequest.test_doubleslashes",
                            "content": "class TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n        self.assertEqual('//foo/', req.path)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 67,
                            "end_lineno": 69,
                            "parent": {
                                "file_name": "tests/test_web_request.py",
                                "type": "class",
                                "name": "TestWebRequest",
                                "content": "class TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n        self.assertEqual('//foo/', req.path)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 10,
                                "end_lineno": 212,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "aa2308fb632bce8eb056d66f7cdb51a469f2572e^",
    "new_commit_hash": "aa2308fb632bce8eb056d66f7cdb51a469f2572e",
    "commit_message": "Fix #489 : properly parse URL's path",
    "commit_date": "2015-09-04T11:12:32-04:00",
    "metadata": {}
}
{
    "repo_name": "aiohttp",
    "new_commit_hash": "aa2308fb632bce8eb056d66f7cdb51a469f2572e",
    "test_file_codes": [
        "import asyncio\nimport json\nimport os.path\nimport socket\nimport unittest\nfrom aiohttp import log, web, request, FormData, ClientSession\nfrom aiohttp.multidict import MultiDict\nfrom aiohttp.protocol import HttpVersion, HttpVersion10, HttpVersion11\nfrom aiohttp.streams import EOF_MARKER\n\n\nclass TestWebFunctional(unittest.TestCase):\n\n    def setUp(self):\n        self.handler = None\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        if self.handler:\n            self.loop.run_until_complete(self.handler.finish_connections())\n        self.loop.close()\n\n    def find_unused_port(self):\n        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n        s.bind(('127.0.0.1', 0))\n        port = s.getsockname()[1]\n        s.close()\n        return port\n\n    @asyncio.coroutine\n    def create_server(self, method, path, handler=None):\n        app = web.Application(loop=self.loop)\n        if handler:\n            app.router.add_route(method, path, handler)\n\n        port = self.find_unused_port()\n        self.handler = app.make_handler(\n            debug=True, keep_alive_on=False,\n            access_log=log.access_logger)\n        srv = yield from self.loop.create_server(\n            self.handler, '127.0.0.1', port)\n        url = \"http://127.0.0.1:{}\".format(port) + path\n        self.addCleanup(srv.close)\n        return app, srv, url\n\n    def test_simple_get(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_handler_returns_not_response(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_form(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_text(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_post_json(self):\n\n        dct = {'key': 'текст'}\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n\n        self.loop.run_until_complete(go())\n\n    def test_render_redirect(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n\n        self.loop.run_until_complete(go())\n\n    def test_post_single_file(self):\n\n        here = os.path.dirname(__file__)\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_post_files(self):\n\n        here = os.path.dirname(__file__)\n\n        f1 = open(os.path.join(here, 'sample.crt'))\n        f2 = open(os.path.join(here, 'sample.key'))\n\n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt', 'sample.key'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=[f1, f2],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n        f1.close()\n        f2.close()\n\n    def test_release_post_data(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_static_file(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_type(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n\n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_with_content_encoding(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_directory_traversal_attack(self):\n\n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n\n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n\n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_past_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_future_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_file_if_modified_since_invalid_date(self):\n\n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n\n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n        self.loop.run_until_complete(go(here, filename))\n\n    def test_static_route_path_existence_check(self):\n        directory = os.path.dirname(__file__)\n        web.StaticRoute(None, \"/\", directory)\n\n        nodirectory = os.path.join(directory, \"nonexistent-uPNiOEAg5d\")\n        with self.assertRaises(ValueError):\n            web.StaticRoute(None, \"/\", nodirectory)\n\n    def test_post_form_with_duplicate_keys(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_repr_for_application(self):\n\n        @asyncio.coroutine\n        def go():\n            app, _, _ = yield from self.create_server('POST', '/')\n            self.assertEqual(\"<Application>\", repr(app))\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom(self):\n\n        expect_received = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_custom_response(self):\n\n        auth_err = False\n\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n\n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n\n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_found(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(404, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_100_continue_for_not_allowed(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n\n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n\n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n\n            self.assertEqual(405, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http09_keep_alive_default(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers_close(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_http10_keep_alive_with_headers(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url,\n                                      data={'file': data},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_upload_file_object(self):\n\n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n        with open(fname, 'rb') as f:\n            data = f.read()\n\n        @asyncio.coroutine\n        def handler(request):\n            form = yield from request.post()\n            raw_data = form['file'].file.read()\n            self.assertEqual(data, raw_data)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(fname, 'rb')\n            resp = yield from request('POST', url,\n                                      data={'file': f},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_without_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_empty_content_for_query_with_body(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_get_with_empty_arg_with_equal(self):\n\n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n\n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n\n        self.loop.run_until_complete(go())\n",
        "import asyncio\nimport unittest\nfrom unittest import mock\n\nfrom aiohttp import web, log\nfrom aiohttp.multidict import CIMultiDict\nfrom aiohttp.protocol import HttpVersion11, RawRequestMessage\n\n\nclass TestWeb(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    @unittest.skip('moved to test_web_functional')\n    def test_handler_returns_not_response(self):\n        app = web.Application(loop=self.loop)\n\n        def handler(request):\n            return 'abc'\n\n        app.router.add_route('GET', '/', handler)\n        h = app.make_handler()()\n        message = RawRequestMessage('GET', '/', HttpVersion11,\n                                    CIMultiDict(), False, False)\n        payload = mock.Mock()\n\n        with self.assertRaises(AssertionError):\n            self.loop.run_until_complete(h.handle_request(message, payload))\n\n    def test_app_ctor(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(self.loop, app.loop)\n        self.assertIs(app.logger, log.web_logger)\n\n    def test_app_call(self):\n        app = web.Application(loop=self.loop)\n        self.assertIs(app, app())\n\n    def test_app_default_loop(self):\n        asyncio.set_event_loop(self.loop)\n        app = web.Application()\n        self.assertIs(self.loop, app.loop)\n\n    def test_app_register_on_finish(self):\n        app = web.Application(loop=self.loop)\n        cb1 = mock.Mock()\n        cb2 = mock.Mock()\n        app.register_on_finish(cb1, 1, b=2)\n        app.register_on_finish(cb2, 2, c=3)\n        self.loop.run_until_complete(app.finish())\n        cb1.assert_called_once_with(app, 1, b=2)\n        cb2.assert_called_once_with(app, 2, c=3)\n\n    def test_app_register_coro(self):\n        app = web.Application(loop=self.loop)\n\n        fut = asyncio.Future(loop=self.loop)\n\n        @asyncio.coroutine\n        def cb(app):\n            yield from asyncio.sleep(0.001, loop=self.loop)\n            fut.set_result(123)\n\n        app.register_on_finish(cb)\n        self.loop.run_until_complete(app.finish())\n        self.assertTrue(fut.done())\n        self.assertEqual(123, fut.result())\n\n    def test_app_error_in_finish_callbacks(self):\n        app = web.Application(loop=self.loop)\n\n        err = RuntimeError('bad call')\n        app.register_on_finish(mock.Mock(side_effect=err))\n        handler = mock.Mock()\n        self.loop.set_exception_handler(handler)\n        self.loop.run_until_complete(app.finish())\n        exc_info = {'exception': err,\n                    'application': app,\n                    'message': 'Error in finish callback'}\n        handler.assert_called_once_with(self.loop, exc_info)\n\n    def test_non_default_router(self):\n        router = web.UrlDispatcher()\n        app = web.Application(loop=self.loop, router=router)\n        self.assertIs(router, app.router)\n\n    def test_logging(self):\n        logger = mock.Mock()\n        app = web.Application(loop=self.loop)\n        app.logger = logger\n        self.assertIs(app.logger, logger)\n\n\nclass TestRequestHandlerFactory(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def test_repr(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        handler = manager()\n\n        self.assertEqual(\n            '<RequestHandler none:none disconnected>', repr(handler))\n\n        handler.transport = object()\n        handler._meth = 'GET'\n        handler._path = '/index.html'\n        self.assertEqual(\n            '<RequestHandler GET:/index.html connected>', repr(handler))\n\n    def test_connections(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n        self.assertEqual(manager.connections, [])\n\n        handler = object()\n        transport = object()\n        manager.connection_made(handler, transport)\n        self.assertEqual(manager.connections, [handler])\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n\n    def test_finish_connection_no_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections())\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=None)\n        transport.close.assert_called_with()\n\n    def test_finish_connection_timeout(self):\n        app = web.Application(loop=self.loop)\n        manager = app.make_handler()\n\n        handler = mock.Mock()\n        transport = mock.Mock()\n        manager.connection_made(handler, transport)\n\n        self.loop.run_until_complete(manager.finish_connections(timeout=0.1))\n\n        manager.connection_lost(handler, None)\n        self.assertEqual(manager.connections, [])\n        handler.closing.assert_called_with(timeout=0.09)\n        transport.close.assert_called_with()\n",
        "import asyncio\nimport unittest\nfrom unittest import mock\nfrom aiohttp.web import Request\nfrom aiohttp.multidict import MultiDict, CIMultiDict\nfrom aiohttp.protocol import HttpVersion\nfrom aiohttp.protocol import RawRequestMessage\n\n\nclass TestWebRequest(unittest.TestCase):\n\n    def setUp(self):\n        self.loop = asyncio.new_event_loop()\n        asyncio.set_event_loop(None)\n\n    def tearDown(self):\n        self.loop.close()\n\n    def make_request(self, method, path, headers=CIMultiDict(), *,\n                     version=HttpVersion(1, 1), closing=False,\n                     sslcontext=None,\n                     secure_proxy_ssl_header=None):\n        if version < HttpVersion(1, 1):\n            closing = True\n        self.app = mock.Mock()\n        message = RawRequestMessage(method, path, version, headers, closing,\n                                    False)\n        self.payload = mock.Mock()\n        self.transport = mock.Mock()\n\n        def get_extra_info(key):\n            if key == 'sslcontext':\n                return sslcontext\n            else:\n                return None\n\n        self.transport.get_extra_info.side_effect = get_extra_info\n        self.writer = mock.Mock()\n        self.reader = mock.Mock()\n        req = Request(self.app, message, self.payload,\n                      self.transport, self.reader, self.writer,\n                      secure_proxy_ssl_header=secure_proxy_ssl_header)\n        return req\n\n    def test_ctor(self):\n        req = self.make_request('GET', '/path/to?a=1&b=2')\n\n        self.assertIs(self.app, req.app)\n        self.assertEqual('GET', req.method)\n        self.assertEqual(HttpVersion(1, 1), req.version)\n        self.assertEqual(None, req.host)\n        self.assertEqual('/path/to?a=1&b=2', req.path_qs)\n        self.assertEqual('/path/to', req.path)\n        self.assertEqual('a=1&b=2', req.query_string)\n\n        get = req.GET\n        self.assertEqual(MultiDict([('a', '1'), ('b', '2')]), get)\n        # second call should return the same object\n        self.assertIs(get, req.GET)\n\n        with self.assertWarns(DeprecationWarning):\n            self.assertIs(self.payload, req.payload)\n        self.assertIs(self.payload, req.content)\n        self.assertIs(self.transport, req.transport)\n        self.assertTrue(req.keep_alive)\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n        self.assertEqual('//foo/', req.path)\n\n    def test_POST(self):\n        req = self.make_request('POST', '/')\n        with self.assertRaises(RuntimeError):\n            req.POST\n\n        marker = object()\n        req._post = marker\n        self.assertIs(req.POST, marker)\n        self.assertIs(req.POST, marker)\n\n    def test_content_type_not_specified(self):\n        req = self.make_request('Get', '/')\n        self.assertEqual('application/octet-stream', req.content_type)\n\n    def test_content_type_from_spec(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'application/json')]))\n        self.assertEqual('application/json', req.content_type)\n\n    def test_content_type_from_spec_with_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('text/html', req.content_type)\n        self.assertEqual('UTF-8', req.charset)\n\n    def test_calc_content_type_on_getting_charset(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-TYPE', 'text/html; charset=UTF-8')]))\n        self.assertEqual('UTF-8', req.charset)\n        self.assertEqual('text/html', req.content_type)\n\n    def test_urlencoded_querystring(self):\n        req = self.make_request(\n            'GET',\n            '/yandsearch?text=%D1%82%D0%B5%D0%BA%D1%81%D1%82')\n        self.assertEqual({'text': 'текст'}, req.GET)\n\n    def test_non_ascii_path(self):\n        req = self.make_request('GET', '/путь')\n        self.assertEqual('/путь', req.path)\n\n    def test_content_length(self):\n        req = self.make_request(\n            'Get', '/',\n            CIMultiDict([('CONTENT-LENGTH', '123')]))\n\n        self.assertEqual(123, req.content_length)\n\n    def test_non_keepalive_on_http10(self):\n        req = self.make_request('GET', '/', version=HttpVersion(1, 0))\n        self.assertFalse(req.keep_alive)\n\n    def test_non_keepalive_on_closing(self):\n        req = self.make_request('GET', '/', closing=True)\n        self.assertFalse(req.keep_alive)\n\n    def test_call_POST_on_GET_request(self):\n        req = self.make_request('GET', '/')\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_on_weird_content_type(self):\n        req = self.make_request(\n            'POST', '/',\n            headers=CIMultiDict({'CONTENT-TYPE': 'something/weird'}))\n\n        ret = self.loop.run_until_complete(req.post())\n        self.assertEqual(CIMultiDict(), ret)\n\n    def test_call_POST_twice(self):\n        req = self.make_request('GET', '/')\n\n        ret1 = self.loop.run_until_complete(req.post())\n        ret2 = self.loop.run_until_complete(req.post())\n        self.assertIs(ret1, ret2)\n\n    def test_no_request_cookies(self):\n        req = self.make_request('GET', '/')\n\n        self.assertEqual(req.cookies, {})\n\n        cookies = req.cookies\n        self.assertIs(cookies, req.cookies)\n\n    def test_request_cookie(self):\n        headers = CIMultiDict(COOKIE='cookie1=value1; cookie2=value2')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {\n            'cookie1': 'value1',\n            'cookie2': 'value2',\n        })\n\n    def test_request_cookie__set_item(self):\n        headers = CIMultiDict(COOKIE='name=value')\n        req = self.make_request('GET', '/', headers=headers)\n\n        self.assertEqual(req.cookies, {'name': 'value'})\n\n        with self.assertRaises(TypeError):\n            req.cookies['my'] = 'value'\n\n    def test_match_info(self):\n        req = self.make_request('GET', '/')\n        self.assertIsNone(req.match_info)\n        match = {'a': 'b'}\n        req._match_info = match\n        self.assertIs(match, req.match_info)\n\n    def test_request_is_dict(self):\n        req = self.make_request('GET', '/')\n        self.assertTrue(isinstance(req, dict))\n        req['key'] = 'value'\n        self.assertEqual('value', req['key'])\n\n    def test___repr__(self):\n        req = self.make_request('GET', '/path/to')\n        self.assertEqual(\"<Request GET /path/to >\", repr(req))\n\n    def test_http_scheme(self):\n        req = self.make_request('GET', '/')\n        self.assertEqual(\"http\", req.scheme)\n\n    def test_https_scheme_by_ssl_transport(self):\n        req = self.make_request('GET', '/', sslcontext=True)\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '1'}))\n        self.assertEqual(\"https\", req.scheme)\n\n    def test_https_scheme_by_secure_proxy_ssl_header_false_test(self):\n        req = self.make_request('GET', '/',\n                                secure_proxy_ssl_header=('X-HEADER', '1'),\n                                headers=CIMultiDict({'X-HEADER': '0'}))\n        self.assertEqual(\"http\", req.scheme)\n"
    ],
    "test_file_names": [
        "test_1.py",
        "test_2.py",
        "test_3.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Transforming aiohttp/worker.py\nTransforming aiohttp/client_reqrep.py\nTransforming aiohttp/server.py\nTransforming aiohttp/client.py\n",
    "setup_res_stderr": "Using CPython 3.9.21\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nmake: *** No rule to make target '.develop'.  Stop.\nResolved 26 packages in 17ms\nInstalled 26 packages in 42ms\n + async-generator==1.10\n + async-timeout==5.0.1\n + brotlipy==0.7.0\n + cffi==1.17.1\n + chardet==5.2.0\n + coverage==7.6.10\n + cryptography==44.0.0\n + cython==3.0.11\n + exceptiongroup==1.2.2\n + gunicorn==23.0.0\n + idna==3.10\n + iniconfig==2.0.0\n + multdict==0.0.5\n + multidict==6.1.0\n + packaging==24.2\n + pluggy==1.5.0\n + propcache==0.2.1\n + pycparser==2.22\n + pytest==8.3.4\n + pytest-asyncio==0.25.0\n + pytest-cov==6.0.0\n + pytest-mock==3.14.0\n + tomli==2.2.1\n + trustme==1.2.1\n + typing-extensions==4.12.2\n + yarl==1.18.3\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.9.21, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e\nplugins: asyncio-0.25.0, mock-3.14.0, cov-6.0.0\nasyncio: mode=strict, asyncio_default_fixture_loop_scope=None\ncollected 76 items\n\nr2e_tests/test_1.py FFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFF.FFF               [ 50%]\nr2e_tests/test_2.py ......s......                                        [ 67%]\nr2e_tests/test_3.py .........................                            [100%]\n\n=================================== FAILURES ===================================\n_____________________ TestWebFunctional.test_100_continue ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue>\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:568: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:560: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad10d640>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad10d1f0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad10d1f0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n__________________ TestWebFunctional.test_100_continue_custom __________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_custom>\n\n    def test_100_continue_custom(self):\n    \n        expect_received = False\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n    \n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n    \n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:608: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:599: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad1897f0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad11bac0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad11bac0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_100_continue_custom_response ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_custom_response>\n\n    def test_100_continue_custom_response(self):\n    \n        auth_err = False\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n    \n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n    \n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n    \n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n    \n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:656: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:640: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad14ddc0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad14d160>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad14d160>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_100_continue_for_not_allowed ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_for_not_allowed>\n\n    def test_100_continue_for_not_allowed(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(405, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:706: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:698: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acefe190>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17acefec10>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acefec10>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________ TestWebFunctional.test_100_continue_for_not_found _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_for_not_found>\n\n    def test_100_continue_for_not_found(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:681: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:673: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad119550>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17ace31370>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ace31370>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______ TestWebFunctional.test_POST_DATA_with_content_transfer_encoding ________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_POST_DATA_with_content_transfer_encoding>\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:309: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:302: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad10de50>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad10d820>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad10d820>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________ TestWebFunctional.test_empty_content_for_query_with_body ___________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_empty_content_for_query_with_body>\n\n    def test_empty_content_for_query_with_body(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:866: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:860: in go\n    resp = yield from request('POST', url, data=b'data',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acb44700>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17acb44550>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acb44550>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_________ TestWebFunctional.test_empty_content_for_query_without_body __________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_empty_content_for_query_without_body>\n\n    def test_empty_content_for_query_without_body(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:847: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:842: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad1ec580>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad1ecd30>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad1ecd30>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________ TestWebFunctional.test_files_upload_with_same_key _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_files_upload_with_same_key>\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:230: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:225: in go\n    resp = yield from request('POST', url, data=_data,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad9f7610>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad9f7bb0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad9f7bb0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n__________________ TestWebFunctional.test_get_with_empty_arg ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_get_with_empty_arg>\n\n    def test_get_with_empty_arg(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:883: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:879: in go\n    resp = yield from request('GET', url+'?arg', loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acea8be0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17acea8c70>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acea8c70>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_get_with_empty_arg_with_equal _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_get_with_empty_arg_with_equal>\n\n    def test_get_with_empty_arg_with_equal(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:900: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:896: in go\n    resp = yield from request('GET', url+'?arg=', loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17aca135e0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17aca13190>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17aca13190>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_handler_returns_not_response ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_handler_returns_not_response>\n\n    def test_handler_returns_not_response(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:77: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:74: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad135be0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad11b190>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad11b190>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________ TestWebFunctional.test_http09_keep_alive_default _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http09_keep_alive_default>\n\n    def test_http09_keep_alive_default(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:742: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:736: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acb6da30>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17acb6d970>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acb6d970>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________ TestWebFunctional.test_http10_keep_alive_default _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_default>\n\n    def test_http10_keep_alive_default(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:723: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:718: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acca04c0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17acca0370>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acca0370>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________ TestWebFunctional.test_http10_keep_alive_with_headers _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_with_headers>\n\n    def test_http10_keep_alive_with_headers(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:778: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:773: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ac9b84f0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17ac9b8460>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ac9b8460>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_________ TestWebFunctional.test_http10_keep_alive_with_headers_close __________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_with_headers_close>\n\n    def test_http10_keep_alive_with_headers_close(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:760: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:755: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acaa8ca0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7e17acaa8100>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acaa8100>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_post_files _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_files>\n\n    def test_post_files(self):\n    \n        here = os.path.dirname(__file__)\n    \n>       f1 = open(os.path.join(here, 'sample.crt'))\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/sample.crt'\n\nr2e_tests/test_1.py:236: FileNotFoundError\n_______________________ TestWebFunctional.test_post_form _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_form>\n\n    def test_post_form(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:96: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:90: in go\n    resp = yield from request('POST', url, data={'a': 1, 'b': 2},\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acb4c5b0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17acb4c2e0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acb4c2e0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_post_form_with_duplicate_keys _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_form_with_duplicate_keys>\n\n    def test_post_form_with_duplicate_keys(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:534: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:526: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad135f10>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad10de20>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad10de20>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________________ TestWebFunctional.test_post_json _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_json>\n\n    def test_post_json(self):\n    \n        dct = {'key': 'текст'}\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:145: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:138: in go\n    resp = yield from request('POST', url, data=json.dumps(dct),\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acf22280>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad9c8d00>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad9c8d00>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________________ TestWebFunctional.test_post_single_file ____________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_single_file>\n\n    def test_post_single_file(self):\n    \n        here = os.path.dirname(__file__)\n    \n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:196: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    @asyncio.coroutine\n    def go():\n        _, _, url = yield from self.create_server('POST', '/', handler)\n>       f = open(os.path.join(here, 'sample.crt'))\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/sample.crt'\n\nr2e_tests/test_1.py:189: FileNotFoundError\n_______________________ TestWebFunctional.test_post_text _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_text>\n\n    def test_post_text(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:117: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:111: in go\n    resp = yield from request('POST', url, data='русский',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad14dfa0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad14d5b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad14d5b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________________ TestWebFunctional.test_release_post_data ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_release_post_data>\n\n    def test_release_post_data(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:285: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:280: in go\n    resp = yield from request('POST', url, data='post text',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acea2070>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17acea2130>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acea2130>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________________ TestWebFunctional.test_render_redirect ____________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_render_redirect>\n\n    def test_render_redirect(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:163: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:156: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17aca8d100>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17aca8d370>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17aca8d370>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_simple_get _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_simple_get>\n\n    def test_simple_get(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:63: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:58: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad1625e0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad1621c0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad1621c0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_static_file ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file>\n\n    def test_static_file(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n    \n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:339: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:320: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17aca8d3a0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad192820>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad192820>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n________ TestWebFunctional.test_static_file_directory_traversal_attack _________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_directory_traversal_attack>\n\n    def test_static_file_directory_traversal_attack(self):\n    \n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n    \n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n    \n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:423: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:406: in go\n    resp = yield from request('GET', url_relpath, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acea89a0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17acea8eb0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acea8eb0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_static_file_if_modified_since _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since>\n\n    def test_static_file_if_modified_since(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n    \n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:447: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:434: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ac9d6940>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7e17ac9d6a90>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ac9d6a90>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______ TestWebFunctional.test_static_file_if_modified_since_future_date _______\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_future_date>\n\n    def test_static_file_if_modified_since_future_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:485: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:478: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acc8be20>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17acc8bdc0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acc8bdc0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______ TestWebFunctional.test_static_file_if_modified_since_invalid_date _______\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_invalid_date>\n\n    def test_static_file_if_modified_since_invalid_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:504: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:497: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad14f340>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad14f910>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad14f910>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n________ TestWebFunctional.test_static_file_if_modified_since_past_date ________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_past_date>\n\n    def test_static_file_if_modified_since_past_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:466: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:459: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ad13c880>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad1be040>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad1be040>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________ TestWebFunctional.test_static_file_with_content_encoding ___________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_with_content_encoding>\n\n    def test_static_file_with_content_encoding(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:394: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:382: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ace3cdc0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17aca5a8b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17aca5a8b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_static_file_with_content_type _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_with_content_type>\n\n    def test_static_file_with_content_type(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n    \n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:371: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:350: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17acb6ddc0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7e17acb6da60>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17acb6da60>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________ TestWebFunctional.test_stream_response_multiple_chunks ____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_stream_response_multiple_chunks>\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:923: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:917: in go\n    resp = yield from client.get(url)\naiohttp/client.py:284: in get\n    resp = yield from self.request(hdrs.METH_GET, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7e17ace31880>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7e17ad11b880>>\nreader = <aiohttp.parsers.StreamParser object at 0x7e17ad11b880>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_upload_file ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_upload_file>\n\n    def test_upload_file(self):\n    \n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n>       with open(fname, 'rb') as f:\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/software_development_in_picture.jpg'\n\nr2e_tests/test_1.py:784: FileNotFoundError\n__________________ TestWebFunctional.test_upload_file_object ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_upload_file_object>\n\n    def test_upload_file_object(self):\n    \n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n>       with open(fname, 'rb') as f:\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/software_development_in_picture.jpg'\n\nr2e_tests/test_1.py:809: FileNotFoundError\n==================================== PASSES ====================================\n___________ TestRequestHandlerFactory.test_finish_connection_timeout ___________\n------------------------------ Captured log call -------------------------------\nWARNING  aiohttp.web:web.py:161 Not all connections are closed (pending: 1)\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestWebFunctional::test_repr_for_application\nPASSED r2e_tests/test_1.py::TestWebFunctional::test_static_route_path_existence_check\nPASSED r2e_tests/test_2.py::TestWeb::test_app_call\nPASSED r2e_tests/test_2.py::TestWeb::test_app_ctor\nPASSED r2e_tests/test_2.py::TestWeb::test_app_default_loop\nPASSED r2e_tests/test_2.py::TestWeb::test_app_error_in_finish_callbacks\nPASSED r2e_tests/test_2.py::TestWeb::test_app_register_coro\nPASSED r2e_tests/test_2.py::TestWeb::test_app_register_on_finish\nPASSED r2e_tests/test_2.py::TestWeb::test_logging\nPASSED r2e_tests/test_2.py::TestWeb::test_non_default_router\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_connections\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_finish_connection_no_timeout\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_finish_connection_timeout\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_repr\nPASSED r2e_tests/test_3.py::TestWebRequest::test_POST\nPASSED r2e_tests/test_3.py::TestWebRequest::test___repr__\nPASSED r2e_tests/test_3.py::TestWebRequest::test_calc_content_type_on_getting_charset\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_on_GET_request\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_on_weird_content_type\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_twice\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_length\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_from_spec\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_from_spec_with_charset\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_not_specified\nPASSED r2e_tests/test_3.py::TestWebRequest::test_ctor\nPASSED r2e_tests/test_3.py::TestWebRequest::test_doubleslashes\nPASSED r2e_tests/test_3.py::TestWebRequest::test_http_scheme\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_secure_proxy_ssl_header\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_secure_proxy_ssl_header_false_test\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_ssl_transport\nPASSED r2e_tests/test_3.py::TestWebRequest::test_match_info\nPASSED r2e_tests/test_3.py::TestWebRequest::test_no_request_cookies\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_ascii_path\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_keepalive_on_closing\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_keepalive_on_http10\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_cookie\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_cookie__set_item\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_is_dict\nPASSED r2e_tests/test_3.py::TestWebRequest::test_urlencoded_querystring\nSKIPPED [1] r2e_tests/test_2.py:19: moved to test_web_functional\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue - TypeError:...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_custom - Typ...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_custom_response\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_for_not_allowed\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_for_not_found\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_POST_DATA_with_content_transfer_encoding\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_empty_content_for_query_with_body\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_empty_content_for_query_without_body\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_files_upload_with_same_key\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_get_with_empty_arg - Type...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_get_with_empty_arg_with_equal\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_handler_returns_not_response\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http09_keep_alive_default\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_default\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_with_headers\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_with_headers_close\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_files - FileNotFound...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_form - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_form_with_duplicate_keys\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_json - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_single_file - FileNo...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_text - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_release_post_data - TypeE...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_render_redirect - TypeErr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_simple_get - TypeError: c...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file - TypeError: ...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_directory_traversal_attack\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_future_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_invalid_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_past_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_with_content_encoding\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_with_content_type\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_stream_response_multiple_chunks\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_upload_file - FileNotFoun...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_upload_file_object - File...\n=================== 36 failed, 39 passed, 1 skipped in 3.57s ===================\n",
    "new_commit_res_stderr": "/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/.venv/lib/python3.9/site-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option \"asyncio_default_fixture_loop_scope\" is unset.\nThe event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: \"function\", \"class\", \"module\", \"package\", \"session\"\n\n  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))\nUnclosed client session\nclient_session: <aiohttp.client.ClientSession object at 0x7e17ad502f70>\n",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.9.21, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e\nplugins: asyncio-0.25.0, mock-3.14.0, cov-6.0.0\nasyncio: mode=strict, asyncio_default_fixture_loop_scope=None\ncollected 76 items\n\nr2e_tests/test_1.py FFFFFFFFFFFFFFFFFFFFFFFF.FFFFFFFFF.FFF               [ 50%]\nr2e_tests/test_2.py ......s......                                        [ 67%]\nr2e_tests/test_3.py ...........F.............                            [100%]\n\n=================================== FAILURES ===================================\n_____________________ TestWebFunctional.test_100_continue ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue>\n\n    def test_100_continue(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:568: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:560: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f487220>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f487e80>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f487e80>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n__________________ TestWebFunctional.test_100_continue_custom __________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_custom>\n\n    def test_100_continue_custom(self):\n    \n        expect_received = False\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def expect_handler(request):\n            nonlocal expect_received\n            expect_received = True\n            if request.version == HttpVersion11:\n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n    \n        @asyncio.coroutine\n        def go():\n            nonlocal expect_received\n    \n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            self.assertTrue(expect_received)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:608: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:599: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f39b2b0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f39b910>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f39b910>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_100_continue_custom_response ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_custom_response>\n\n    def test_100_continue_custom_response(self):\n    \n        auth_err = False\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def expect_handler(request):\n            if request.version == HttpVersion11:\n                if auth_err:\n                    return web.HTTPForbidden()\n    \n                request.transport.write(b\"HTTP/1.1 100 Continue\\r\\n\\r\\n\")\n    \n        @asyncio.coroutine\n        def go():\n            nonlocal auth_err\n    \n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route(\n                'POST', '/', handler, expect_handler=expect_handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close(force=True)\n    \n            auth_err = True\n            resp = yield from request(\n                'post', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n            self.assertEqual(403, resp.status)\n            resp.close(force=True)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:656: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:640: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f421df0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f421430>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f421430>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_100_continue_for_not_allowed ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_for_not_allowed>\n\n    def test_100_continue_for_not_allowed(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'GET', url, data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(405, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:706: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:698: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f39b880>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f39ba30>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f39ba30>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________ TestWebFunctional.test_100_continue_for_not_found _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_100_continue_for_not_found>\n\n    def test_100_continue_for_not_found(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            app, _, url = yield from self.create_server('POST', '/')\n            app.router.add_route('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url + 'not_found', data=form,\n                expect100=True,  # wait until server returns 100 continue\n                loop=self.loop)\n    \n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:681: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:673: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f3bfca0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f3bf1f0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f3bf1f0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______ TestWebFunctional.test_POST_DATA_with_content_transfer_encoding ________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_POST_DATA_with_content_transfer_encoding>\n\n    def test_POST_DATA_with_content_transfer_encoding(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(b'123', data['name'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n    \n            form = FormData()\n            form.add_field('name', b'123',\n                           content_transfer_encoding='base64')\n    \n            resp = yield from request(\n                'post', url, data=form,\n                loop=self.loop)\n    \n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:309: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:302: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f41b9a0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f41bd90>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f41bd90>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________ TestWebFunctional.test_empty_content_for_query_with_body ___________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_empty_content_for_query_with_body>\n\n    def test_empty_content_for_query_with_body(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertTrue(request.has_body)\n            body = yield from request.read()\n            return web.Response(body=body)\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data=b'data',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('data', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:866: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:860: in go\n    resp = yield from request('POST', url, data=b'data',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f39b2b0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f39b940>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f39b940>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_________ TestWebFunctional.test_empty_content_for_query_without_body __________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_empty_content_for_query_without_body>\n\n    def test_empty_content_for_query_without_body(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertFalse(request.has_body)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:847: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:842: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f082130>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f082af0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f082af0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________ TestWebFunctional.test_files_upload_with_same_key _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_files_upload_with_same_key>\n\n    def test_files_upload_with_same_key(self):\n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            files = data.getall('file')\n            _file_names = []\n            for _file in files:\n                self.assertFalse(_file.file.closed)\n                if _file.filename == 'test1.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 1')\n                if _file.filename == 'test2.jpeg':\n                    self.assertEqual(_file.file.read(), b'binary data 2')\n                _file_names.append(_file.filename)\n            self.assertCountEqual(_file_names, ['test1.jpeg', 'test2.jpeg'])\n            resp = web.Response(body=b'OK')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            _data = FormData()\n            _data.add_field('file', b'binary data 1',\n                            content_type='image/jpeg',\n                            filename='test1.jpeg')\n            _data.add_field('file', b'binary data 2',\n                            content_type='image/jpeg',\n                            filename='test2.jpeg')\n            resp = yield from request('POST', url, data=_data,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:230: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:225: in go\n    resp = yield from request('POST', url, data=_data,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f416c40>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f4169a0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f4169a0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n__________________ TestWebFunctional.test_get_with_empty_arg ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_get_with_empty_arg>\n\n    def test_get_with_empty_arg(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:883: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:879: in go\n    resp = yield from request('GET', url+'?arg', loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f41b850>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f41ba90>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f41ba90>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_get_with_empty_arg_with_equal _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_get_with_empty_arg_with_equal>\n\n    def test_get_with_empty_arg_with_equal(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            self.assertIn('arg', request.GET)\n            self.assertEqual('', request.GET['arg'])\n            return web.Response()\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url+'?arg=', loop=self.loop)\n            self.assertEqual(200, resp.status)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:900: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:896: in go\n    resp = yield from request('GET', url+'?arg=', loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f394a30>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f394730>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f394730>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_handler_returns_not_response ______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_handler_returns_not_response>\n\n    def test_handler_returns_not_response(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            return 'abc'\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(500, resp.status)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:77: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:74: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f4146d0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f4148b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f4148b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________ TestWebFunctional.test_http09_keep_alive_default _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http09_keep_alive_default>\n\n    def test_http09_keep_alive_default(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            headers = {'Connection': 'keep-alive'}  # should be ignored\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers,\n                                      version=HttpVersion(0, 9))\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:742: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:736: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f0de490>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f336340>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f336340>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________ TestWebFunctional.test_http10_keep_alive_default _______________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_default>\n\n    def test_http10_keep_alive_default(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:723: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:718: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f41b730>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f21a8b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f21a8b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________ TestWebFunctional.test_http10_keep_alive_with_headers _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_with_headers>\n\n    def test_http10_keep_alive_with_headers(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'keep-alive'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('keep-alive', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:778: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:773: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f0de520>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f4e4c10>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f4e4c10>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_________ TestWebFunctional.test_http10_keep_alive_with_headers_close __________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_http10_keep_alive_with_headers_close>\n\n    def test_http10_keep_alive_with_headers_close(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.read()\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            headers = {'Connection': 'close'}\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers=headers, version=HttpVersion10)\n            self.assertEqual('close', resp.headers['CONNECTION'])\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:760: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:755: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f178a90>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f178550>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f178550>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_post_files _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_files>\n\n    def test_post_files(self):\n    \n        here = os.path.dirname(__file__)\n    \n>       f1 = open(os.path.join(here, 'sample.crt'))\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/sample.crt'\n\nr2e_tests/test_1.py:236: FileNotFoundError\n_______________________ TestWebFunctional.test_post_form _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_form>\n\n    def test_post_form(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual({'a': '1', 'b': '2'}, dict(data))\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data={'a': 1, 'b': 2},\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:96: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:90: in go\n    resp = yield from request('POST', url, data={'a': 1, 'b': 2},\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f4142b0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7bac7eff7d60>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7eff7d60>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_post_form_with_duplicate_keys _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_form_with_duplicate_keys>\n\n    def test_post_form_with_duplicate_keys(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            lst = list(sorted(data.items()))\n            self.assertEqual([('a', '1'), ('a', '2')], lst)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request(\n                'POST', url,\n                data=MultiDict([('a', 1), ('a', 2)]),\n                loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:534: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:526: in go\n    resp = yield from request(\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f412e50>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f412550>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f412550>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______________________ TestWebFunctional.test_post_json _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_json>\n\n    def test_post_json(self):\n    \n        dct = {'key': 'текст'}\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.json()\n            self.assertEqual(dct, data)\n            data2 = yield from request.json()\n            self.assertEqual(data, data2)\n            resp = web.Response()\n            resp.content_type = 'application/json'\n            resp.body = json.dumps(data).encode('utf8')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            headers = {'Content-Type': 'application/json'}\n            resp = yield from request('POST', url, data=json.dumps(dct),\n                                      headers=headers,\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.json()\n            self.assertEqual(dct, data)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:145: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:138: in go\n    resp = yield from request('POST', url, data=json.dumps(dct),\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f50cfa0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f50c8b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f50c8b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________________ TestWebFunctional.test_post_single_file ____________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_single_file>\n\n    def test_post_single_file(self):\n    \n        here = os.path.dirname(__file__)\n    \n        def check_file(fs):\n            fullname = os.path.join(here, fs.filename)\n            with open(fullname, 'r') as f:\n                test_data = f.read().encode()\n                data = fs.file.read()\n                self.assertEqual(test_data, data)\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.post()\n            self.assertEqual(['sample.crt'], list(data.keys()))\n            for fs in data.values():\n                check_file(fs)\n                fs.file.close()\n            resp = web.Response(body=b'OK')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            f = open(os.path.join(here, 'sample.crt'))\n            resp = yield from request('POST', url, data=[f],\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n            f.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:196: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n    @asyncio.coroutine\n    def go():\n        _, _, url = yield from self.create_server('POST', '/', handler)\n>       f = open(os.path.join(here, 'sample.crt'))\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/sample.crt'\n\nr2e_tests/test_1.py:189: FileNotFoundError\n_______________________ TestWebFunctional.test_post_text _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_post_text>\n\n    def test_post_text(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            data = yield from request.text()\n            self.assertEqual('русский', data)\n            data2 = yield from request.text()\n            self.assertEqual(data, data2)\n            return web.Response(text=data)\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='русский',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('русский', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:117: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:111: in go\n    resp = yield from request('POST', url, data='русский',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7efe1a00>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7efe11c0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7efe11c0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________________ TestWebFunctional.test_release_post_data ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_release_post_data>\n\n    def test_release_post_data(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            yield from request.release()\n            chunk = yield from request.content.readany()\n            self.assertIs(EOF_MARKER, chunk)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('POST', '/', handler)\n            resp = yield from request('POST', url, data='post text',\n                                      loop=self.loop)\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:285: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:280: in go\n    resp = yield from request('POST', url, data='post text',\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f41ba30>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f41b2e0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f41b2e0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________________ TestWebFunctional.test_render_redirect ____________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_render_redirect>\n\n    def test_render_redirect(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            raise web.HTTPMovedPermanently(location='/path')\n    \n        @asyncio.coroutine\n        def go():\n            _, _, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop,\n                                      allow_redirects=False)\n            self.assertEqual(301, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('301: Moved Permanently', txt)\n            self.assertEqual('/path', resp.headers['location'])\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:163: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:156: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7efe1b80>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7efe12b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7efe12b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_simple_get _______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_simple_get>\n\n    def test_simple_get(self):\n    \n        @asyncio.coroutine\n        def handler(request):\n            body = yield from request.read()\n            self.assertEqual(b'', body)\n            return web.Response(body=b'OK')\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('OK', txt)\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:63: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:58: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f86dbb0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f4120d0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f4120d0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_static_file ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file>\n\n    def test_static_file(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            txt = yield from resp.text()\n            self.assertEqual('file content', txt.rstrip())\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('application/octet-stream', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n    \n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:339: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:320: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f32a370>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f32a2b0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f32a2b0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n________ TestWebFunctional.test_static_file_directory_traversal_attack _________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_directory_traversal_attack>\n\n    def test_static_file_directory_traversal_attack(self):\n    \n        @asyncio.coroutine\n        def go(dirname, relpath):\n            self.assertTrue(os.path.isfile(os.path.join(dirname, relpath)))\n    \n            app, _, url = yield from self.create_server('GET', '/static/')\n            app.router.add_static('/static', dirname)\n    \n            url_relpath = url + relpath\n            resp = yield from request('GET', url_relpath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            url_relpath2 = url + 'dir/../' + filename\n            resp = yield from request('GET', url_relpath2, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            url_abspath = \\\n                url + os.path.abspath(os.path.join(dirname, filename))\n            resp = yield from request('GET', url_abspath, loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = '../README.rst'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:423: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:406: in go\n    resp = yield from request('GET', url_relpath, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f1e86a0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f1e83a0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f1e83a0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_static_file_if_modified_since _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since>\n\n    def test_static_file_if_modified_since(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            lastmod = resp.headers.get('Last-Modified')\n            self.assertIsNotNone(lastmod)\n            resp.close()\n    \n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:447: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:434: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f414430>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f414970>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f414970>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_______ TestWebFunctional.test_static_file_if_modified_since_future_date _______\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_future_date>\n\n    def test_static_file_if_modified_since_future_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(304, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:485: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:478: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f416970>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=20> reader=<aiohttp.parsers.StreamParser object at 0x7bac7efd87c0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7efd87c0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______ TestWebFunctional.test_static_file_if_modified_since_invalid_date _______\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_invalid_date>\n\n    def test_static_file_if_modified_since_invalid_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'not a valid HTTP-date'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:504: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:497: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f1e88b0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f1e8280>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f1e8280>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n________ TestWebFunctional.test_static_file_if_modified_since_past_date ________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_if_modified_since_past_date>\n\n    def test_static_file_if_modified_since_past_date(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            lastmod = 'Mon, 1 Jan 1990 01:01:01 GMT'\n            resp = yield from request('GET', url, loop=self.loop,\n                                      headers={'If-Modified-Since': lastmod})\n            self.assertEqual(200, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'data.unknown_mime_type'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:466: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:459: in go\n    resp = yield from request('GET', url, loop=self.loop,\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f03b160>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f03b1c0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f03b1c0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n___________ TestWebFunctional.test_static_file_with_content_encoding ___________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_with_content_encoding>\n\n    def test_static_file_with_content_encoding(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            self.assertEqual(b'hello aiohttp\\n', body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('text/plain', ct)\n            encoding = resp.headers['CONTENT-ENCODING']\n            self.assertEqual('gzip', encoding)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'hello.txt.gz'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:394: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:382: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f336550>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=22> reader=<aiohttp.parsers.StreamParser object at 0x7bac7efe2e20>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7efe2e20>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n_____________ TestWebFunctional.test_static_file_with_content_type _____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_static_file_with_content_type>\n\n    def test_static_file_with_content_type(self):\n    \n        @asyncio.coroutine\n        def go(dirname, filename):\n            app, _, url = yield from self.create_server(\n                'GET', '/static/' + filename\n            )\n            app.router.add_static('/static', dirname, chunk_size=16)\n    \n            resp = yield from request('GET', url, loop=self.loop)\n            self.assertEqual(200, resp.status)\n            body = yield from resp.read()\n            with open(os.path.join(dirname, filename), 'rb') as f:\n                content = f.read()\n                self.assertEqual(content, body)\n            ct = resp.headers['CONTENT-TYPE']\n            self.assertEqual('image/jpeg', ct)\n            self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)\n            resp.close()\n    \n            resp = yield from request('GET', url + 'fake', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n            resp = yield from request('GET', url + '/../../', loop=self.loop)\n            self.assertEqual(404, resp.status)\n            resp.close()\n    \n        here = os.path.dirname(__file__)\n        filename = 'software_development_in_picture.jpg'\n>       self.loop.run_until_complete(go(here, filename))\n\nr2e_tests/test_1.py:371: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:350: in go\n    resp = yield from request('GET', url, loop=self.loop)\naiohttp/client.py:453: in request\n    resp = yield from session.request(method, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f1780a0>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=16> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f178b80>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f178b80>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n____________ TestWebFunctional.test_stream_response_multiple_chunks ____________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_stream_response_multiple_chunks>\n\n    def test_stream_response_multiple_chunks(self):\n        @asyncio.coroutine\n        def handler(request):\n            resp = web.StreamResponse()\n            resp.enable_chunked_encoding()\n            resp.start(request)\n            resp.write(b'x')\n            resp.write(b'y')\n            resp.write(b'z')\n            return resp\n    \n        @asyncio.coroutine\n        def go():\n            _, srv, url = yield from self.create_server('GET', '/', handler)\n            client = ClientSession(loop=self.loop)\n            resp = yield from client.get(url)\n            self.assertEqual(200, resp.status)\n            data = yield from resp.read()\n            self.assertEqual(b'xyz', data)\n            yield from resp.release()\n    \n>       self.loop.run_until_complete(go())\n\nr2e_tests/test_1.py:923: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/base_events.py:647: in run_until_complete\n    return future.result()\nr2e_tests/test_1.py:917: in go\n    resp = yield from client.get(url)\naiohttp/client.py:284: in get\n    resp = yield from self.request(hdrs.METH_GET, url,\naiohttp/client.py:133: in request\n    resp = req.send(conn.writer, conn.reader)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <aiohttp.client_reqrep.ClientRequest object at 0x7bac7f0de730>\nwriter = <StreamWriter transport=<_SelectorSocketTransport fd=18> reader=<aiohttp.parsers.StreamParser object at 0x7bac7f21aeb0>>\nreader = <aiohttp.parsers.StreamParser object at 0x7bac7f21aeb0>\n\n    def send(self, writer, reader):\n        request = aiohttp.Request(writer, self.method, self.path, self.version)\n    \n        if self.compress:\n            request.add_compression_filter(self.compress)\n    \n        if self.chunked is not None:\n            request.enable_chunked_encoding()\n            request.add_chunking_filter(self.chunked)\n    \n        # set default content-type\n        if (self.method in self.POST_METHODS and\n                hdrs.CONTENT_TYPE not in self.headers):\n            self.headers[hdrs.CONTENT_TYPE] = 'application/octet-stream'\n    \n        request.add_headers(\n            *((k, v)\n              for k, v in ((k, value)\n                           for k, value in self.headers.items())))\n        request.send_headers()\n    \n>       self._writer = asyncio.create_task(\n            self.write_bytes(request, reader), loop=self.loop)\nE       TypeError: create_task() got an unexpected keyword argument 'loop'\n\naiohttp/client_reqrep.py:457: TypeError\n------------------------------ Captured log call -------------------------------\nERROR    asyncio:base_events.py:1753 Exception in callback RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)\nhandle: <Handle RequestHandler.connection_made(<_SelectorSoc...e, bufsize=0>>)>\nTraceback (most recent call last):\n  File \"/home/gcpuser/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/lib/python3.9/asyncio/events.py\", line 80, in _run\n    self._context.run(self._callback, *self._args)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/web.py\", line 48, in connection_made\n    super().connection_made(transport)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/aiohttp/server.py\", line 147, in connection_made\n    self._request_handler = asyncio.create_task(self.start(), loop=self._loop)\nTypeError: create_task() got an unexpected keyword argument 'loop'\n______________________ TestWebFunctional.test_upload_file ______________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_upload_file>\n\n    def test_upload_file(self):\n    \n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n>       with open(fname, 'rb') as f:\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/software_development_in_picture.jpg'\n\nr2e_tests/test_1.py:784: FileNotFoundError\n__________________ TestWebFunctional.test_upload_file_object ___________________\n\nself = <r2e_tests.test_1.TestWebFunctional testMethod=test_upload_file_object>\n\n    def test_upload_file_object(self):\n    \n        here = os.path.dirname(__file__)\n        fname = os.path.join(here, 'software_development_in_picture.jpg')\n>       with open(fname, 'rb') as f:\nE       FileNotFoundError: [Errno 2] No such file or directory: '/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/r2e_tests/software_development_in_picture.jpg'\n\nr2e_tests/test_1.py:809: FileNotFoundError\n______________________ TestWebRequest.test_doubleslashes _______________________\n\nself = <r2e_tests.test_3.TestWebRequest testMethod=test_doubleslashes>\n\n    def test_doubleslashes(self):\n        req = self.make_request('GET', '//foo/')\n>       self.assertEqual('//foo/', req.path)\nE       AssertionError: '//foo/' != '/'\nE       - //foo/\nE       + /\n\nr2e_tests/test_3.py:69: AssertionError\n==================================== PASSES ====================================\n___________ TestRequestHandlerFactory.test_finish_connection_timeout ___________\n------------------------------ Captured log call -------------------------------\nWARNING  aiohttp.web:web.py:161 Not all connections are closed (pending: 1)\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestWebFunctional::test_repr_for_application\nPASSED r2e_tests/test_1.py::TestWebFunctional::test_static_route_path_existence_check\nPASSED r2e_tests/test_2.py::TestWeb::test_app_call\nPASSED r2e_tests/test_2.py::TestWeb::test_app_ctor\nPASSED r2e_tests/test_2.py::TestWeb::test_app_default_loop\nPASSED r2e_tests/test_2.py::TestWeb::test_app_error_in_finish_callbacks\nPASSED r2e_tests/test_2.py::TestWeb::test_app_register_coro\nPASSED r2e_tests/test_2.py::TestWeb::test_app_register_on_finish\nPASSED r2e_tests/test_2.py::TestWeb::test_logging\nPASSED r2e_tests/test_2.py::TestWeb::test_non_default_router\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_connections\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_finish_connection_no_timeout\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_finish_connection_timeout\nPASSED r2e_tests/test_2.py::TestRequestHandlerFactory::test_repr\nPASSED r2e_tests/test_3.py::TestWebRequest::test_POST\nPASSED r2e_tests/test_3.py::TestWebRequest::test___repr__\nPASSED r2e_tests/test_3.py::TestWebRequest::test_calc_content_type_on_getting_charset\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_on_GET_request\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_on_weird_content_type\nPASSED r2e_tests/test_3.py::TestWebRequest::test_call_POST_twice\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_length\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_from_spec\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_from_spec_with_charset\nPASSED r2e_tests/test_3.py::TestWebRequest::test_content_type_not_specified\nPASSED r2e_tests/test_3.py::TestWebRequest::test_ctor\nPASSED r2e_tests/test_3.py::TestWebRequest::test_http_scheme\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_secure_proxy_ssl_header\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_secure_proxy_ssl_header_false_test\nPASSED r2e_tests/test_3.py::TestWebRequest::test_https_scheme_by_ssl_transport\nPASSED r2e_tests/test_3.py::TestWebRequest::test_match_info\nPASSED r2e_tests/test_3.py::TestWebRequest::test_no_request_cookies\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_ascii_path\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_keepalive_on_closing\nPASSED r2e_tests/test_3.py::TestWebRequest::test_non_keepalive_on_http10\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_cookie\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_cookie__set_item\nPASSED r2e_tests/test_3.py::TestWebRequest::test_request_is_dict\nPASSED r2e_tests/test_3.py::TestWebRequest::test_urlencoded_querystring\nSKIPPED [1] r2e_tests/test_2.py:19: moved to test_web_functional\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue - TypeError:...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_custom - Typ...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_custom_response\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_for_not_allowed\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_100_continue_for_not_found\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_POST_DATA_with_content_transfer_encoding\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_empty_content_for_query_with_body\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_empty_content_for_query_without_body\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_files_upload_with_same_key\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_get_with_empty_arg - Type...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_get_with_empty_arg_with_equal\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_handler_returns_not_response\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http09_keep_alive_default\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_default\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_with_headers\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_http10_keep_alive_with_headers_close\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_files - FileNotFound...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_form - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_form_with_duplicate_keys\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_json - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_single_file - FileNo...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_post_text - TypeError: cr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_release_post_data - TypeE...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_render_redirect - TypeErr...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_simple_get - TypeError: c...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file - TypeError: ...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_directory_traversal_attack\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_future_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_invalid_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_if_modified_since_past_date\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_with_content_encoding\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_static_file_with_content_type\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_stream_response_multiple_chunks\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_upload_file - FileNotFoun...\nFAILED r2e_tests/test_1.py::TestWebFunctional::test_upload_file_object - File...\nFAILED r2e_tests/test_3.py::TestWebRequest::test_doubleslashes - AssertionErr...\n=================== 37 failed, 38 passed, 1 skipped in 2.93s ===================\n",
    "old_commit_res_stderr": "/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_aa2308fb632bce8eb056d66f7cdb51a469f2572e/.venv/lib/python3.9/site-packages/pytest_asyncio/plugin.py:207: PytestDeprecationWarning: The configuration option \"asyncio_default_fixture_loop_scope\" is unset.\nThe event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: \"function\", \"class\", \"module\", \"package\", \"session\"\n\n  warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))\nUnclosed client session\nclient_session: <aiohttp.client.ClientSession object at 0x7bac7f0de5b0>\n"
}
aiohttp/web_reqrep.py tests/test_web.py tests/test_web_functional.py tests/test_web_request.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Incorrect Parsing of URLs with Double Slashes in Path**

**Description**
When a URL containing double slashes in the path is parsed, the resulting path is incorrectly set to a single slash. This causes the application to misinterpret the intended path structure.

For example, parsing the URL `http://example.com//foo/` results in the path being `/` instead of the expected `//foo/`.

```python
def test_doubleslashes(self):
    req = self.make_request('GET', '//foo/')
    print(req.path)  # Outputs: '/'
```

**Expected Behavior**
The path should retain the double slashes, resulting in `//foo/`, accurately reflecting the original URL structure.

**Actual Behavior**
The path is incorrectly parsed as `/`, ignoring the double slashes and leading to potential routing and resource access issues.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### aiohttp/web_reqrep.py
__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')

import asyncio
import binascii
import cgi
import collections
import datetime
import http.cookies
import io
import json
import math
import time
import warnings

import enum

from email.utils import parsedate
from types import MappingProxyType
from urllib.parse import urlsplit, parse_qsl, unquote

from . import hdrs
from .helpers import reify
from .multidict import (CIMultiDictProxy,
                        CIMultiDict,
                        MultiDictProxy,
                        MultiDict)
from .protocol import Response as ResponseImpl, HttpVersion10
from .streams import EOF_MARKER


sentinel = object()


class HeadersMixin:

    _content_type = None
    _content_dict = None
    _stored_content_type = sentinel

    def _parse_content_type(self, raw):
        self._stored_content_type = raw
        if raw is None:
            # default value according to RFC 2616
            self._content_type = 'application/octet-stream'
            self._content_dict = {}
        else:
            self._content_type, self._content_dict = cgi.parse_header(raw)

    @property
    def content_type(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):
        """The value of content part for Content-Type HTTP header."""
        raw = self.headers.get(_CONTENT_TYPE)
        if self._stored_content_type != raw:
            self._parse_content_type(raw)
        return self._content_type

    @property
    def charset(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):
        """The value of charset part for Content-Type HTTP header."""
        raw = self.headers.get(_CONTENT_TYPE)
        if self._stored_content_type != raw:
            self._parse_content_type(raw)
        return self._content_dict.get('charset')

    @property
    def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):
        """The value of Content-Length HTTP header."""
        l = self.headers.get(_CONTENT_LENGTH)
        if l is None:
            return None
        else:
            return int(l)

FileField = collections.namedtuple('Field', 'name filename file content_type')


class ContentCoding(enum.Enum):
    # The content codings that we have support for.
    #
    # Additional registered codings are listed at:
    # https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding
    deflate = 'deflate'
    gzip = 'gzip'
    identity = 'identity'


############################################################
# HTTP Request
############################################################


class Request(dict, HeadersMixin):

    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,
                    hdrs.METH_TRACE, hdrs.METH_DELETE}

    def __init__(self, app, message, payload, transport, reader, writer, *,
                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):
        self._app = app
        self._version = message.version
        self._transport = transport
        self._reader = reader
        self._writer = writer
        self._method = message.method
        self._host = message.headers.get(_HOST)
        self._path_qs = message.path
        self._post = None
        self._post_files_cache = None
        self._headers = CIMultiDictProxy(message.headers)
        if self._version < HttpVersion10:
            self._keep_alive = False
        else:
            self._keep_alive = not message.should_close

        # matchdict, route_name, handler
        # or information about traversal lookup
        self._match_info = None  # initialized after route resolving

        self._payload = payload
        self._cookies = None

        self._read_bytes = None
        self._has_body = not payload.at_eof()

        self._secure_proxy_ssl_header = secure_proxy_ssl_header

    @property
    def scheme(self):
        """A string representing the scheme of the request.

        'http' or 'https'.
        """
        if self._transport.get_extra_info('sslcontext'):
            return 'https'
        secure_proxy_ssl_header = self._secure_proxy_ssl_header
        if secure_proxy_ssl_header is not None:
            header, value = secure_proxy_ssl_header
            if self._headers.get(header) == value:
                return 'https'
        return 'http'

    @property
    def method(self):
        """Read only property for getting HTTP method.

        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.
        """
        return self._method

    @property
    def version(self):
        """Read only property for getting HTTP version of request.

        Returns aiohttp.protocol.HttpVersion instance.
        """
        return self._version

    @property
    def host(self):
        """Read only property for getting *HOST* header of request.

        Returns str or None if HTTP request has no HOST header.
        """
        return self._host

    @property
    def path_qs(self):
        """The URL including PATH_INFO and the query string.

        E.g, /app/blog?id=10
        """
        return self._path_qs

    @reify
    def _splitted_path(self):
        return urlsplit(self._path_qs)

    @property
    def raw_path(self):
        """ The URL including raw *PATH INFO* without the host or scheme.
        Warning, the path is unquoted and may contains non valid URL characters

        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``
        """
        return self._splitted_path.path

    @reify
    def path(self):
        """The URL including *PATH INFO* without the host or scheme.

        E.g., ``/app/blog``
        """
        return unquote(self.raw_path)

    @reify
    def query_string(self):
        """The query string in the URL.

        E.g., id=10
        """
        return self._splitted_path.query

    @reify
    def GET(self):
        """A multidict with all the variables in the query string.

        Lazy property.
        """
        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,
                                                  keep_blank_values=True)))

    @reify
    def POST(self):
        """A multidict with all the variables in the POST parameters.

        post() methods has to be called before using this attribute.
        """
        if self._post is None:
            raise RuntimeError("POST is not available before post()")
        return self._post

    @property
    def headers(self):
        """A case-insensitive multidict proxy with all headers."""
        return self._headers

    @property
    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):
        """The value of If-Modified-Since HTTP header, or None.

        This header is represented as a `datetime` object.
        """
        httpdate = self.headers.get(_IF_MODIFIED_SINCE)
        if httpdate is not None:
            timetuple = parsedate(httpdate)
            if timetuple is not None:
                return datetime.datetime(*timetuple[:6],
                                         tzinfo=datetime.timezone.utc)
        return None

    @property
    def keep_alive(self):
        """Is keepalive enabled by client?"""
        return self._keep_alive

    @property
    def match_info(self):
        """Result of route resolving."""
        return self._match_info

    @property
    def app(self):
        """Application instance."""
        return self._app

    @property
    def transport(self):
        """Transport used for request processing."""
        return self._transport

    @property
    def cookies(self):
        """Return request cookies.

        A read-only dictionary-like object.
        """
        if self._cookies is None:
            raw = self.headers.get(hdrs.COOKIE, '')
            parsed = http.cookies.SimpleCookie(raw)
            self._cookies = MappingProxyType(
                {key: val.value for key, val in parsed.items()})
        return self._cookies

    @property
    def payload(self):
        """Return raw payload stream."""
        warnings.warn('use Request.content instead', DeprecationWarning)
        return self._payload

    @property
    def content(self):
        """Return raw payload stream."""
        return self._payload

    @property
    def has_body(self):
        """Return True if request has HTTP BODY, False otherwise."""
        return self._has_body

    @asyncio.coroutine
    def release(self):
        """Release request.

        Eat unread part of HTTP BODY if present.
        """
        chunk = yield from self._payload.readany()
        while chunk is not EOF_MARKER or chunk:
            chunk = yield from self._payload.readany()

    @asyncio.coroutine
    def read(self):
        """Read request body if present.

        Returns bytes object with full request content.
        """
        if self._read_bytes is None:
            body = bytearray()
            while True:
                chunk = yield from self._payload.readany()
                body.extend(chunk)
                if chunk is EOF_MARKER:
                    break
            self._read_bytes = bytes(body)
        return self._read_bytes

    @asyncio.coroutine
    def text(self):
        """Return BODY as text using encoding from .charset."""
        bytes_body = yield from self.read()
        encoding = self.charset or 'utf-8'
        return bytes_body.decode(encoding)

    @asyncio.coroutine
    def json(self, *, loader=json.loads):
        """Return BODY as JSON."""
        body = yield from self.text()
        return loader(body)

    @asyncio.coroutine
    def post(self):
        """Return POST parameters."""
        if self._post is not None:
            return self._post
        if self.method not in self.POST_METHODS:
            self._post = MultiDictProxy(MultiDict())
            return self._post

        content_type = self.content_type
        if (content_type not in ('',
                                 'application/x-www-form-urlencoded',
                                 'multipart/form-data')):
            self._post = MultiDictProxy(MultiDict())
            return self._post

        body = yield from self.read()
        content_charset = self.charset or 'utf-8'

        environ = {'REQUEST_METHOD': self.method,
                   'CONTENT_LENGTH': str(len(body)),
                   'QUERY_STRING': '',
                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}

        fs = cgi.FieldStorage(fp=io.BytesIO(body),
                              environ=environ,
                              keep_blank_values=True,
                              encoding=content_charset)

        supported_transfer_encoding = {
            'base64': binascii.a2b_base64,
            'quoted-printable': binascii.a2b_qp
        }

        out = MultiDict()
        _count = 1
        for field in fs.list or ():
            transfer_encoding = field.headers.get(
                hdrs.CONTENT_TRANSFER_ENCODING, None)
            if field.filename:
                ff = FileField(field.name,
                               field.filename,
                               field.file,  # N.B. file closed error
                               field.type)
                if self._post_files_cache is None:
                    self._post_files_cache = {}
                self._post_files_cache[field.name+str(_count)] = field
                _count += 1
                out.add(field.name, ff)
            else:
                value = field.value
                if transfer_encoding in supported_transfer_encoding:
                    # binascii accepts bytes
                    value = value.encode('utf-8')
                    value = supported_transfer_encoding[
                        transfer_encoding](value)
                out.add(field.name, value)

        self._post = MultiDictProxy(out)
        return self._post

    def __repr__(self):
        return "<{} {} {} >".format(self.__class__.__name__,
                                    self.method, self.path)


############################################################
# HTTP Response classes
############################################################


class StreamResponse(HeadersMixin):

    def __init__(self, *, status=200, reason=None, headers=None):
        self._body = None
        self._keep_alive = None
        self._chunked = False
        self._chunk_size = None
        self._compression = False
        self._compression_force = False
        self._headers = CIMultiDict()
        self._cookies = http.cookies.SimpleCookie()
        self.set_status(status, reason)

        self._req = None
        self._resp_impl = None
        self._eof_sent = False

        if headers is not None:
            self._headers.extend(headers)

    def _copy_cookies(self):
        for cookie in self._cookies.values():
            value = cookie.output(header='')[1:]
            self.headers.add(hdrs.SET_COOKIE, value)

    @property
    def started(self):
        return self._resp_impl is not None

    @property
    def status(self):
        return self._status

    @property
    def chunked(self):
        return self._chunked

    @property
    def compression(self):
        return self._compression

    @property
    def reason(self):
        return self._reason

    def set_status(self, status, reason=None):
        self._status = int(status)
        if reason is None:
            reason = ResponseImpl.calc_reason(status)
        self._reason = reason

    @property
    def keep_alive(self):
        return self._keep_alive

    def force_close(self):
        self._keep_alive = False

    def enable_chunked_encoding(self, chunk_size=None):
        """Enables automatic chunked transfer encoding."""
        self._chunked = True
        self._chunk_size = chunk_size

    def enable_compression(self, force=None):
        """Enables response compression encoding."""
        # Backwards compatibility for when force was a bool <0.17.
        if type(force) == bool:
            force = ContentCoding.deflate if force else ContentCoding.identity

        self._compression = True
        self._compression_force = force

    @property
    def headers(self):
        return self._headers

    @property
    def cookies(self):
        return self._cookies

    def set_cookie(self, name, value, *, expires=None,
                   domain=None, max_age=None, path='/',
                   secure=None, httponly=None, version=None):
        """Set or update response cookie.

        Sets new cookie or updates existent with new value.
        Also updates only those params which are not None.
        """

        old = self._cookies.get(name)
        if old is not None and old.coded_value == '':
            # deleted cookie
            self._cookies.pop(name, None)

        self._cookies[name] = value
        c = self._cookies[name]
        if expires is not None:
            c['expires'] = expires
        if domain is not None:
            c['domain'] = domain
        if max_age is not None:
            c['max-age'] = max_age
        if path is not None:
            c['path'] = path
        if secure is not None:
            c['secure'] = secure
        if httponly is not None:
            c['httponly'] = httponly
        if version is not None:
            c['version'] = version

    def del_cookie(self, name, *, domain=None, path='/'):
        """Delete cookie.

        Creates new empty expired cookie.
        """
        # TODO: do we need domain/path here?
        self._cookies.pop(name, None)
        self.set_cookie(name, '', max_age=0, domain=domain, path=path)

    @property
    def content_length(self):
        # Just a placeholder for adding setter
        return super().content_length

    @content_length.setter
    def content_length(self, value):
        if value is not None:
            value = int(value)
            # TODO: raise error if chunked enabled
            self.headers[hdrs.CONTENT_LENGTH] = str(value)
        else:
            self.headers.pop(hdrs.CONTENT_LENGTH, None)

    @property
    def content_type(self):
        # Just a placeholder for adding setter
        return super().content_type

    @content_type.setter
    def content_type(self, value):
        self.content_type  # read header values if needed
        self._content_type = str(value)
        self._generate_content_type_header()

    @property
    def charset(self):
        # Just a placeholder for adding setter
        return super().charset

    @charset.setter
    def charset(self, value):
        ctype = self.content_type  # read header values if needed
        if ctype == 'application/octet-stream':
            raise RuntimeError("Setting charset for application/octet-stream "
                               "doesn't make sense, setup content_type first")
        if value is None:
            self._content_dict.pop('charset', None)
        else:
            self._content_dict['charset'] = str(value).lower()
        self._generate_content_type_header()

    @property
    def last_modified(self, _LAST_MODIFIED=hdrs.LAST_MODIFIED):
        """The value of Last-Modified HTTP header, or None.

        This header is represented as a `datetime` object.
        """
        httpdate = self.headers.get(_LAST_MODIFIED)
        if httpdate is not None:
            timetuple = parsedate(httpdate)
            if timetuple is not None:
                return datetime.datetime(*timetuple[:6],
                                         tzinfo=datetime.timezone.utc)
        return None

    @last_modified.setter
    def last_modified(self, value):
        if value is None:
            if hdrs.LAST_MODIFIED in self.headers:
                del self.headers[hdrs.LAST_MODIFIED]
        elif isinstance(value, (int, float)):
            self.headers[hdrs.LAST_MODIFIED] = time.strftime(
                "%a, %d %b %Y %H:%M:%S GMT", time.gmtime(math.ceil(value)))
        elif isinstance(value, datetime.datetime):
            self.headers[hdrs.LAST_MODIFIED] = time.strftime(
                "%a, %d %b %Y %H:%M:%S GMT", value.utctimetuple())
        elif isinstance(value, str):
            self.headers[hdrs.LAST_MODIFIED] = value

    def _generate_content_type_header(self, CONTENT_TYPE=hdrs.CONTENT_TYPE):
        params = '; '.join("%s=%s" % i for i in self._content_dict.items())
        if params:
            ctype = self._content_type + '; ' + params
        else:
            ctype = self._content_type
        self.headers[CONTENT_TYPE] = ctype

    def _start_pre_check(self, request):
        if self._resp_impl is not None:
            if self._req is not request:
                raise RuntimeError(
                    'Response has been started with different request.')
            else:
                return self._resp_impl
        else:
            return None

    def _start_compression(self, request):
        def start(coding):
            if coding != ContentCoding.identity:
                self.headers[hdrs.CONTENT_ENCODING] = coding.value
                self._resp_impl.add_compression_filter(coding.value)
                self.content_length = None

        if self._compression_force:
            start(self._compression_force)
        else:
            accept_encoding = request.headers.get(
                hdrs.ACCEPT_ENCODING, '').lower()
            for coding in ContentCoding:
                if coding.value in accept_encoding:
                    start(coding)
                    return

    def start(self, request):
        resp_impl = self._start_pre_check(request)
        if resp_impl is not None:
            return resp_impl

        self._req = request
        keep_alive = self._keep_alive
        if keep_alive is None:
            keep_alive = request.keep_alive
        self._keep_alive = keep_alive

        resp_impl = self._resp_impl = ResponseImpl(
            request._writer,
            self._status,
            request.version,
            not keep_alive,
            self._reason)

        self._copy_cookies()

        if self._compression:
            self._start_compression(request)

        if self._chunked:
            resp_impl.enable_chunked_encoding()
            if self._chunk_size:
                resp_impl.add_chunking_filter(self._chunk_size)

        headers = self.headers.items()
        for key, val in headers:
            resp_impl.add_header(key, val)

        resp_impl.send_headers()
        return resp_impl

    def write(self, data):
        assert isinstance(data, (bytes, bytearray, memoryview)), \
            'data argument must be byte-ish (%r)' % type(data)

        if self._eof_sent:
            raise RuntimeError("Cannot call write() after write_eof()")
        if self._resp_impl is None:
            raise RuntimeError("Cannot call write() before start()")

        if data:
            return self._resp_impl.write(data)
        else:
            return ()

    @asyncio.coroutine
    def drain(self):
        if self._resp_impl is None:
            raise RuntimeError("Response has not been started")
        yield from self._resp_impl.transport.drain()

    @asyncio.coroutine
    def write_eof(self):
        if self._eof_sent:
            return
        if self._resp_impl is None:
            raise RuntimeError("Response has not been started")

        yield from self._resp_impl.write_eof()
        self._eof_sent = True

    def __repr__(self):
        if self.started:
            info = "{} {} ".format(self._req.method, self._req.path)
        else:
            info = "not started"
        return "<{} {} {}>".format(self.__class__.__name__,
                                   self.reason, info)


class Response(StreamResponse):

    def __init__(self, *, body=None, status=200,
                 reason=None, text=None, headers=None, content_type=None):
        super().__init__(status=status, reason=reason, headers=headers)

        if body is not None and text is not None:
            raise ValueError("body and text are not allowed together.")

        if text is not None:
            if hdrs.CONTENT_TYPE not in self.headers:
                # fast path for filling headers
                if not isinstance(text, str):
                    raise TypeError('text argument must be str (%r)' %
                                    type(text))
                if content_type is None:
                    content_type = 'text/plain'
                self.headers[hdrs.CONTENT_TYPE] = (
                    content_type + '; charset=utf-8')
                self._content_type = content_type
                self._content_dict = {'charset': 'utf-8'}
                self.body = text.encode('utf-8')
            else:
                self.text = text
        else:
            if content_type:
                self.content_type = content_type
            if body is not None:
                self.body = body
            else:
                self.body = None

    @property
    def body(self):
        return self._body

    @body.setter
    def body(self, body):
        if body is not None and not isinstance(body, bytes):
            raise TypeError('body argument must be bytes (%r)' % type(body))
        self._body = body
        if body is not None:
            self.content_length = len(body)
        else:
            self.content_length = 0

    @property
    def text(self):
        if self._body is None:
            return None
        return self._body.decode(self.charset or 'utf-8')

    @text.setter
    def text(self, text):
        if text is not None and not isinstance(text, str):
            raise TypeError('text argument must be str (%r)' % type(text))

        if self.content_type == 'application/octet-stream':
            self.content_type = 'text/plain'
        if self.charset is None:
            self.charset = 'utf-8'

        self.body = text.encode(self.charset)

    @asyncio.coroutine
    def write_eof(self):
        body = self._body
        if body is not None:
            self.write(body)
        yield from super().write_eof()

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]

**Incorrect Parsing of URLs with Double Slashes in Path**

**Description**
When a URL containing double slashes in the path is parsed, the resulting path is incorrectly set to a single slash. This causes the application to misinterpret the intended path structure.

For example, parsing the URL `http://example.com//foo/` results in the path being `/` instead of the expected `//foo/`.

```python
def test_doubleslashes(self):
    req = self.make_request('GET', '//foo/')
    print(req.path)  # Outputs: '/'
```

**Expected Behavior**
The path should retain the double slashes, resulting in `//foo/`, accurately reflecting the original URL structure.

**Actual Behavior**
The path is incorrectly parsed as `/`, ignoring the double slashes and leading to potential routing and resource access issues.

[/ISSUE]
{
    "TestWebFunctional.test_repr_for_application": "PASSED",
    "TestWebFunctional.test_static_route_path_existence_check": "PASSED",
    "TestWeb.test_app_call": "PASSED",
    "TestWeb.test_app_ctor": "PASSED",
    "TestWeb.test_app_default_loop": "PASSED",
    "TestWeb.test_app_error_in_finish_callbacks": "PASSED",
    "TestWeb.test_app_register_coro": "PASSED",
    "TestWeb.test_app_register_on_finish": "PASSED",
    "TestWeb.test_logging": "PASSED",
    "TestWeb.test_non_default_router": "PASSED",
    "TestRequestHandlerFactory.test_connections": "PASSED",
    "TestRequestHandlerFactory.test_finish_connection_no_timeout": "PASSED",
    "TestRequestHandlerFactory.test_finish_connection_timeout": "PASSED",
    "TestRequestHandlerFactory.test_repr": "PASSED",
    "TestWebRequest.test_POST": "PASSED",
    "TestWebRequest.test___repr__": "PASSED",
    "TestWebRequest.test_calc_content_type_on_getting_charset": "PASSED",
    "TestWebRequest.test_call_POST_on_GET_request": "PASSED",
    "TestWebRequest.test_call_POST_on_weird_content_type": "PASSED",
    "TestWebRequest.test_call_POST_twice": "PASSED",
    "TestWebRequest.test_content_length": "PASSED",
    "TestWebRequest.test_content_type_from_spec": "PASSED",
    "TestWebRequest.test_content_type_from_spec_with_charset": "PASSED",
    "TestWebRequest.test_content_type_not_specified": "PASSED",
    "TestWebRequest.test_ctor": "PASSED",
    "TestWebRequest.test_doubleslashes": "PASSED",
    "TestWebRequest.test_http_scheme": "PASSED",
    "TestWebRequest.test_https_scheme_by_secure_proxy_ssl_header": "PASSED",
    "TestWebRequest.test_https_scheme_by_secure_proxy_ssl_header_false_test": "PASSED",
    "TestWebRequest.test_https_scheme_by_ssl_transport": "PASSED",
    "TestWebRequest.test_match_info": "PASSED",
    "TestWebRequest.test_no_request_cookies": "PASSED",
    "TestWebRequest.test_non_ascii_path": "PASSED",
    "TestWebRequest.test_non_keepalive_on_closing": "PASSED",
    "TestWebRequest.test_non_keepalive_on_http10": "PASSED",
    "TestWebRequest.test_request_cookie": "PASSED",
    "TestWebRequest.test_request_cookie__set_item": "PASSED",
    "TestWebRequest.test_request_is_dict": "PASSED",
    "TestWebRequest.test_urlencoded_querystring": "PASSED",
    "TestWebFunctional.test_100_continue": "FAILED",
    "TestWebFunctional.test_100_continue_custom": "FAILED",
    "TestWebFunctional.test_100_continue_custom_response": "FAILED",
    "TestWebFunctional.test_100_continue_for_not_allowed": "FAILED",
    "TestWebFunctional.test_100_continue_for_not_found": "FAILED",
    "TestWebFunctional.test_POST_DATA_with_content_transfer_encoding": "FAILED",
    "TestWebFunctional.test_empty_content_for_query_with_body": "FAILED",
    "TestWebFunctional.test_empty_content_for_query_without_body": "FAILED",
    "TestWebFunctional.test_files_upload_with_same_key": "FAILED",
    "TestWebFunctional.test_get_with_empty_arg": "FAILED",
    "TestWebFunctional.test_get_with_empty_arg_with_equal": "FAILED",
    "TestWebFunctional.test_handler_returns_not_response": "FAILED",
    "TestWebFunctional.test_http09_keep_alive_default": "FAILED",
    "TestWebFunctional.test_http10_keep_alive_default": "FAILED",
    "TestWebFunctional.test_http10_keep_alive_with_headers": "FAILED",
    "TestWebFunctional.test_http10_keep_alive_with_headers_close": "FAILED",
    "TestWebFunctional.test_post_files": "FAILED",
    "TestWebFunctional.test_post_form": "FAILED",
    "TestWebFunctional.test_post_form_with_duplicate_keys": "FAILED",
    "TestWebFunctional.test_post_json": "FAILED",
    "TestWebFunctional.test_post_single_file": "FAILED",
    "TestWebFunctional.test_post_text": "FAILED",
    "TestWebFunctional.test_release_post_data": "FAILED",
    "TestWebFunctional.test_render_redirect": "FAILED",
    "TestWebFunctional.test_simple_get": "FAILED",
    "TestWebFunctional.test_static_file": "FAILED",
    "TestWebFunctional.test_static_file_directory_traversal_attack": "FAILED",
    "TestWebFunctional.test_static_file_if_modified_since": "FAILED",
    "TestWebFunctional.test_static_file_if_modified_since_future_date": "FAILED",
    "TestWebFunctional.test_static_file_if_modified_since_invalid_date": "FAILED",
    "TestWebFunctional.test_static_file_if_modified_since_past_date": "FAILED",
    "TestWebFunctional.test_static_file_with_content_encoding": "FAILED",
    "TestWebFunctional.test_static_file_with_content_type": "FAILED",
    "TestWebFunctional.test_stream_response_multiple_chunks": "FAILED",
    "TestWebFunctional.test_upload_file": "FAILED",
    "TestWebFunctional.test_upload_file_object": "FAILED"
}
diff --git a/aiohttp/web_reqrep.py b/aiohttp/web_reqrep.py
index 6f3e566c..c3e8abc4 100644
--- a/aiohttp/web_reqrep.py
+++ b/aiohttp/web_reqrep.py
@@ -173,7 +173,8 @@ class Request(dict, HeadersMixin):
 
     @reify
     def _splitted_path(self):
-        return urlsplit(self._path_qs)
+        url = '{}://{}{}'.format(self.scheme, self.host, self._path_qs)
+        return urlsplit(url)
 
     @property
     def raw_path(self):

{"aiohttp/web_reqrep.py": "__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')\n\nimport asyncio\nimport binascii\nimport cgi\nimport collections\nimport datetime\nimport http.cookies\nimport io\nimport json\nimport math\nimport time\nimport warnings\n\nimport enum\n\nfrom email.utils import parsedate\nfrom types import MappingProxyType\nfrom urllib.parse import urlsplit, parse_qsl, unquote\n\nfrom . import hdrs\nfrom .helpers import reify\nfrom .multidict import (CIMultiDictProxy,\n                        CIMultiDict,\n                        MultiDictProxy,\n                        MultiDict)\nfrom .protocol import Response as ResponseImpl, HttpVersion10\nfrom .streams import EOF_MARKER\n\n\nsentinel = object()\n\n\nclass HeadersMixin:\n\n    _content_type = None\n    _content_dict = None\n    _stored_content_type = sentinel\n\n    def _parse_content_type(self, raw):\n        self._stored_content_type = raw\n        if raw is None:\n            # default value according to RFC 2616\n            self._content_type = 'application/octet-stream'\n            self._content_dict = {}\n        else:\n            self._content_type, self._content_dict = cgi.parse_header(raw)\n\n    @property\n    def content_type(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of content part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_type\n\n    @property\n    def charset(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        \"\"\"The value of charset part for Content-Type HTTP header.\"\"\"\n        raw = self.headers.get(_CONTENT_TYPE)\n        if self._stored_content_type != raw:\n            self._parse_content_type(raw)\n        return self._content_dict.get('charset')\n\n    @property\n    def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):\n        \"\"\"The value of Content-Length HTTP header.\"\"\"\n        l = self.headers.get(_CONTENT_LENGTH)\n        if l is None:\n            return None\n        else:\n            return int(l)\n\nFileField = collections.namedtuple('Field', 'name filename file content_type')\n\n\nclass ContentCoding(enum.Enum):\n    # The content codings that we have support for.\n    #\n    # Additional registered codings are listed at:\n    # https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding\n    deflate = 'deflate'\n    gzip = 'gzip'\n    identity = 'identity'\n\n\n############################################################\n# HTTP Request\n############################################################\n\n\nclass Request(dict, HeadersMixin):\n\n    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,\n                    hdrs.METH_TRACE, hdrs.METH_DELETE}\n\n    def __init__(self, app, message, payload, transport, reader, writer, *,\n                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):\n        self._app = app\n        self._version = message.version\n        self._transport = transport\n        self._reader = reader\n        self._writer = writer\n        self._method = message.method\n        self._host = message.headers.get(_HOST)\n        self._path_qs = message.path\n        self._post = None\n        self._post_files_cache = None\n        self._headers = CIMultiDictProxy(message.headers)\n        if self._version < HttpVersion10:\n            self._keep_alive = False\n        else:\n            self._keep_alive = not message.should_close\n\n        # matchdict, route_name, handler\n        # or information about traversal lookup\n        self._match_info = None  # initialized after route resolving\n\n        self._payload = payload\n        self._cookies = None\n\n        self._read_bytes = None\n        self._has_body = not payload.at_eof()\n\n        self._secure_proxy_ssl_header = secure_proxy_ssl_header\n\n    @property\n    def scheme(self):\n        \"\"\"A string representing the scheme of the request.\n\n        'http' or 'https'.\n        \"\"\"\n        if self._transport.get_extra_info('sslcontext'):\n            return 'https'\n        secure_proxy_ssl_header = self._secure_proxy_ssl_header\n        if secure_proxy_ssl_header is not None:\n            header, value = secure_proxy_ssl_header\n            if self._headers.get(header) == value:\n                return 'https'\n        return 'http'\n\n    @property\n    def method(self):\n        \"\"\"Read only property for getting HTTP method.\n\n        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.\n        \"\"\"\n        return self._method\n\n    @property\n    def version(self):\n        \"\"\"Read only property for getting HTTP version of request.\n\n        Returns aiohttp.protocol.HttpVersion instance.\n        \"\"\"\n        return self._version\n\n    @property\n    def host(self):\n        \"\"\"Read only property for getting *HOST* header of request.\n\n        Returns str or None if HTTP request has no HOST header.\n        \"\"\"\n        return self._host\n\n    @property\n    def path_qs(self):\n        \"\"\"The URL including PATH_INFO and the query string.\n\n        E.g, /app/blog?id=10\n        \"\"\"\n        return self._path_qs\n\n    @reify\n    def _splitted_path(self):\n        return urlsplit(self._path_qs)\n\n    @property\n    def raw_path(self):\n        \"\"\" The URL including raw *PATH INFO* without the host or scheme.\n        Warning, the path is unquoted and may contains non valid URL characters\n\n        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``\n        \"\"\"\n        return self._splitted_path.path\n\n    @reify\n    def path(self):\n        \"\"\"The URL including *PATH INFO* without the host or scheme.\n\n        E.g., ``/app/blog``\n        \"\"\"\n        return unquote(self.raw_path)\n\n    @reify\n    def query_string(self):\n        \"\"\"The query string in the URL.\n\n        E.g., id=10\n        \"\"\"\n        return self._splitted_path.query\n\n    @reify\n    def GET(self):\n        \"\"\"A multidict with all the variables in the query string.\n\n        Lazy property.\n        \"\"\"\n        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,\n                                                  keep_blank_values=True)))\n\n    @reify\n    def POST(self):\n        \"\"\"A multidict with all the variables in the POST parameters.\n\n        post() methods has to be called before using this attribute.\n        \"\"\"\n        if self._post is None:\n            raise RuntimeError(\"POST is not available before post()\")\n        return self._post\n\n    @property\n    def headers(self):\n        \"\"\"A case-insensitive multidict proxy with all headers.\"\"\"\n        return self._headers\n\n    @property\n    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):\n        \"\"\"The value of If-Modified-Since HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_IF_MODIFIED_SINCE)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @property\n    def keep_alive(self):\n        \"\"\"Is keepalive enabled by client?\"\"\"\n        return self._keep_alive\n\n    @property\n    def match_info(self):\n        \"\"\"Result of route resolving.\"\"\"\n        return self._match_info\n\n    @property\n    def app(self):\n        \"\"\"Application instance.\"\"\"\n        return self._app\n\n    @property\n    def transport(self):\n        \"\"\"Transport used for request processing.\"\"\"\n        return self._transport\n\n    @property\n    def cookies(self):\n        \"\"\"Return request cookies.\n\n        A read-only dictionary-like object.\n        \"\"\"\n        if self._cookies is None:\n            raw = self.headers.get(hdrs.COOKIE, '')\n            parsed = http.cookies.SimpleCookie(raw)\n            self._cookies = MappingProxyType(\n                {key: val.value for key, val in parsed.items()})\n        return self._cookies\n\n    @property\n    def payload(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        warnings.warn('use Request.content instead', DeprecationWarning)\n        return self._payload\n\n    @property\n    def content(self):\n        \"\"\"Return raw payload stream.\"\"\"\n        return self._payload\n\n    @property\n    def has_body(self):\n        \"\"\"Return True if request has HTTP BODY, False otherwise.\"\"\"\n        return self._has_body\n\n    @asyncio.coroutine\n    def release(self):\n        \"\"\"Release request.\n\n        Eat unread part of HTTP BODY if present.\n        \"\"\"\n        chunk = yield from self._payload.readany()\n        while chunk is not EOF_MARKER or chunk:\n            chunk = yield from self._payload.readany()\n\n    @asyncio.coroutine\n    def read(self):\n        \"\"\"Read request body if present.\n\n        Returns bytes object with full request content.\n        \"\"\"\n        if self._read_bytes is None:\n            body = bytearray()\n            while True:\n                chunk = yield from self._payload.readany()\n                body.extend(chunk)\n                if chunk is EOF_MARKER:\n                    break\n            self._read_bytes = bytes(body)\n        return self._read_bytes\n\n    @asyncio.coroutine\n    def text(self):\n        \"\"\"Return BODY as text using encoding from .charset.\"\"\"\n        bytes_body = yield from self.read()\n        encoding = self.charset or 'utf-8'\n        return bytes_body.decode(encoding)\n\n    @asyncio.coroutine\n    def json(self, *, loader=json.loads):\n        \"\"\"Return BODY as JSON.\"\"\"\n        body = yield from self.text()\n        return loader(body)\n\n    @asyncio.coroutine\n    def post(self):\n        \"\"\"Return POST parameters.\"\"\"\n        if self._post is not None:\n            return self._post\n        if self.method not in self.POST_METHODS:\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        content_type = self.content_type\n        if (content_type not in ('',\n                                 'application/x-www-form-urlencoded',\n                                 'multipart/form-data')):\n            self._post = MultiDictProxy(MultiDict())\n            return self._post\n\n        body = yield from self.read()\n        content_charset = self.charset or 'utf-8'\n\n        environ = {'REQUEST_METHOD': self.method,\n                   'CONTENT_LENGTH': str(len(body)),\n                   'QUERY_STRING': '',\n                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}\n\n        fs = cgi.FieldStorage(fp=io.BytesIO(body),\n                              environ=environ,\n                              keep_blank_values=True,\n                              encoding=content_charset)\n\n        supported_transfer_encoding = {\n            'base64': binascii.a2b_base64,\n            'quoted-printable': binascii.a2b_qp\n        }\n\n        out = MultiDict()\n        _count = 1\n        for field in fs.list or ():\n            transfer_encoding = field.headers.get(\n                hdrs.CONTENT_TRANSFER_ENCODING, None)\n            if field.filename:\n                ff = FileField(field.name,\n                               field.filename,\n                               field.file,  # N.B. file closed error\n                               field.type)\n                if self._post_files_cache is None:\n                    self._post_files_cache = {}\n                self._post_files_cache[field.name+str(_count)] = field\n                _count += 1\n                out.add(field.name, ff)\n            else:\n                value = field.value\n                if transfer_encoding in supported_transfer_encoding:\n                    # binascii accepts bytes\n                    value = value.encode('utf-8')\n                    value = supported_transfer_encoding[\n                        transfer_encoding](value)\n                out.add(field.name, value)\n\n        self._post = MultiDictProxy(out)\n        return self._post\n\n    def __repr__(self):\n        return \"<{} {} {} >\".format(self.__class__.__name__,\n                                    self.method, self.path)\n\n\n############################################################\n# HTTP Response classes\n############################################################\n\n\nclass StreamResponse(HeadersMixin):\n\n    def __init__(self, *, status=200, reason=None, headers=None):\n        self._body = None\n        self._keep_alive = None\n        self._chunked = False\n        self._chunk_size = None\n        self._compression = False\n        self._compression_force = False\n        self._headers = CIMultiDict()\n        self._cookies = http.cookies.SimpleCookie()\n        self.set_status(status, reason)\n\n        self._req = None\n        self._resp_impl = None\n        self._eof_sent = False\n\n        if headers is not None:\n            self._headers.extend(headers)\n\n    def _copy_cookies(self):\n        for cookie in self._cookies.values():\n            value = cookie.output(header='')[1:]\n            self.headers.add(hdrs.SET_COOKIE, value)\n\n    @property\n    def started(self):\n        return self._resp_impl is not None\n\n    @property\n    def status(self):\n        return self._status\n\n    @property\n    def chunked(self):\n        return self._chunked\n\n    @property\n    def compression(self):\n        return self._compression\n\n    @property\n    def reason(self):\n        return self._reason\n\n    def set_status(self, status, reason=None):\n        self._status = int(status)\n        if reason is None:\n            reason = ResponseImpl.calc_reason(status)\n        self._reason = reason\n\n    @property\n    def keep_alive(self):\n        return self._keep_alive\n\n    def force_close(self):\n        self._keep_alive = False\n\n    def enable_chunked_encoding(self, chunk_size=None):\n        \"\"\"Enables automatic chunked transfer encoding.\"\"\"\n        self._chunked = True\n        self._chunk_size = chunk_size\n\n    def enable_compression(self, force=None):\n        \"\"\"Enables response compression encoding.\"\"\"\n        # Backwards compatibility for when force was a bool <0.17.\n        if type(force) == bool:\n            force = ContentCoding.deflate if force else ContentCoding.identity\n\n        self._compression = True\n        self._compression_force = force\n\n    @property\n    def headers(self):\n        return self._headers\n\n    @property\n    def cookies(self):\n        return self._cookies\n\n    def set_cookie(self, name, value, *, expires=None,\n                   domain=None, max_age=None, path='/',\n                   secure=None, httponly=None, version=None):\n        \"\"\"Set or update response cookie.\n\n        Sets new cookie or updates existent with new value.\n        Also updates only those params which are not None.\n        \"\"\"\n\n        old = self._cookies.get(name)\n        if old is not None and old.coded_value == '':\n            # deleted cookie\n            self._cookies.pop(name, None)\n\n        self._cookies[name] = value\n        c = self._cookies[name]\n        if expires is not None:\n            c['expires'] = expires\n        if domain is not None:\n            c['domain'] = domain\n        if max_age is not None:\n            c['max-age'] = max_age\n        if path is not None:\n            c['path'] = path\n        if secure is not None:\n            c['secure'] = secure\n        if httponly is not None:\n            c['httponly'] = httponly\n        if version is not None:\n            c['version'] = version\n\n    def del_cookie(self, name, *, domain=None, path='/'):\n        \"\"\"Delete cookie.\n\n        Creates new empty expired cookie.\n        \"\"\"\n        # TODO: do we need domain/path here?\n        self._cookies.pop(name, None)\n        self.set_cookie(name, '', max_age=0, domain=domain, path=path)\n\n    @property\n    def content_length(self):\n        # Just a placeholder for adding setter\n        return super().content_length\n\n    @content_length.setter\n    def content_length(self, value):\n        if value is not None:\n            value = int(value)\n            # TODO: raise error if chunked enabled\n            self.headers[hdrs.CONTENT_LENGTH] = str(value)\n        else:\n            self.headers.pop(hdrs.CONTENT_LENGTH, None)\n\n    @property\n    def content_type(self):\n        # Just a placeholder for adding setter\n        return super().content_type\n\n    @content_type.setter\n    def content_type(self, value):\n        self.content_type  # read header values if needed\n        self._content_type = str(value)\n        self._generate_content_type_header()\n\n    @property\n    def charset(self):\n        # Just a placeholder for adding setter\n        return super().charset\n\n    @charset.setter\n    def charset(self, value):\n        ctype = self.content_type  # read header values if needed\n        if ctype == 'application/octet-stream':\n            raise RuntimeError(\"Setting charset for application/octet-stream \"\n                               \"doesn't make sense, setup content_type first\")\n        if value is None:\n            self._content_dict.pop('charset', None)\n        else:\n            self._content_dict['charset'] = str(value).lower()\n        self._generate_content_type_header()\n\n    @property\n    def last_modified(self, _LAST_MODIFIED=hdrs.LAST_MODIFIED):\n        \"\"\"The value of Last-Modified HTTP header, or None.\n\n        This header is represented as a `datetime` object.\n        \"\"\"\n        httpdate = self.headers.get(_LAST_MODIFIED)\n        if httpdate is not None:\n            timetuple = parsedate(httpdate)\n            if timetuple is not None:\n                return datetime.datetime(*timetuple[:6],\n                                         tzinfo=datetime.timezone.utc)\n        return None\n\n    @last_modified.setter\n    def last_modified(self, value):\n        if value is None:\n            if hdrs.LAST_MODIFIED in self.headers:\n                del self.headers[hdrs.LAST_MODIFIED]\n        elif isinstance(value, (int, float)):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", time.gmtime(math.ceil(value)))\n        elif isinstance(value, datetime.datetime):\n            self.headers[hdrs.LAST_MODIFIED] = time.strftime(\n                \"%a, %d %b %Y %H:%M:%S GMT\", value.utctimetuple())\n        elif isinstance(value, str):\n            self.headers[hdrs.LAST_MODIFIED] = value\n\n    def _generate_content_type_header(self, CONTENT_TYPE=hdrs.CONTENT_TYPE):\n        params = '; '.join(\"%s=%s\" % i for i in self._content_dict.items())\n        if params:\n            ctype = self._content_type + '; ' + params\n        else:\n            ctype = self._content_type\n        self.headers[CONTENT_TYPE] = ctype\n\n    def _start_pre_check(self, request):\n        if self._resp_impl is not None:\n            if self._req is not request:\n                raise RuntimeError(\n                    'Response has been started with different request.')\n            else:\n                return self._resp_impl\n        else:\n            return None\n\n    def _start_compression(self, request):\n        def start(coding):\n            if coding != ContentCoding.identity:\n                self.headers[hdrs.CONTENT_ENCODING] = coding.value\n                self._resp_impl.add_compression_filter(coding.value)\n                self.content_length = None\n\n        if self._compression_force:\n            start(self._compression_force)\n        else:\n            accept_encoding = request.headers.get(\n                hdrs.ACCEPT_ENCODING, '').lower()\n            for coding in ContentCoding:\n                if coding.value in accept_encoding:\n                    start(coding)\n                    return\n\n    def start(self, request):\n        resp_impl = self._start_pre_check(request)\n        if resp_impl is not None:\n            return resp_impl\n\n        self._req = request\n        keep_alive = self._keep_alive\n        if keep_alive is None:\n            keep_alive = request.keep_alive\n        self._keep_alive = keep_alive\n\n        resp_impl = self._resp_impl = ResponseImpl(\n            request._writer,\n            self._status,\n            request.version,\n            not keep_alive,\n            self._reason)\n\n        self._copy_cookies()\n\n        if self._compression:\n            self._start_compression(request)\n\n        if self._chunked:\n            resp_impl.enable_chunked_encoding()\n            if self._chunk_size:\n                resp_impl.add_chunking_filter(self._chunk_size)\n\n        headers = self.headers.items()\n        for key, val in headers:\n            resp_impl.add_header(key, val)\n\n        resp_impl.send_headers()\n        return resp_impl\n\n    def write(self, data):\n        assert isinstance(data, (bytes, bytearray, memoryview)), \\\n            'data argument must be byte-ish (%r)' % type(data)\n\n        if self._eof_sent:\n            raise RuntimeError(\"Cannot call write() after write_eof()\")\n        if self._resp_impl is None:\n            raise RuntimeError(\"Cannot call write() before start()\")\n\n        if data:\n            return self._resp_impl.write(data)\n        else:\n            return ()\n\n    @asyncio.coroutine\n    def drain(self):\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n        yield from self._resp_impl.transport.drain()\n\n    @asyncio.coroutine\n    def write_eof(self):\n        if self._eof_sent:\n            return\n        if self._resp_impl is None:\n            raise RuntimeError(\"Response has not been started\")\n\n        yield from self._resp_impl.write_eof()\n        self._eof_sent = True\n\n    def __repr__(self):\n        if self.started:\n            info = \"{} {} \".format(self._req.method, self._req.path)\n        else:\n            info = \"not started\"\n        return \"<{} {} {}>\".format(self.__class__.__name__,\n                                   self.reason, info)\n\n\nclass Response(StreamResponse):\n\n    def __init__(self, *, body=None, status=200,\n                 reason=None, text=None, headers=None, content_type=None):\n        super().__init__(status=status, reason=reason, headers=headers)\n\n        if body is not None and text is not None:\n            raise ValueError(\"body and text are not allowed together.\")\n\n        if text is not None:\n            if hdrs.CONTENT_TYPE not in self.headers:\n                # fast path for filling headers\n                if not isinstance(text, str):\n                    raise TypeError('text argument must be str (%r)' %\n                                    type(text))\n                if content_type is None:\n                    content_type = 'text/plain'\n                self.headers[hdrs.CONTENT_TYPE] = (\n                    content_type + '; charset=utf-8')\n                self._content_type = content_type\n                self._content_dict = {'charset': 'utf-8'}\n                self.body = text.encode('utf-8')\n            else:\n                self.text = text\n        else:\n            if content_type:\n                self.content_type = content_type\n            if body is not None:\n                self.body = body\n            else:\n                self.body = None\n\n    @property\n    def body(self):\n        return self._body\n\n    @body.setter\n    def body(self, body):\n        if body is not None and not isinstance(body, bytes):\n            raise TypeError('body argument must be bytes (%r)' % type(body))\n        self._body = body\n        if body is not None:\n            self.content_length = len(body)\n        else:\n            self.content_length = 0\n\n    @property\n    def text(self):\n        if self._body is None:\n            return None\n        return self._body.decode(self.charset or 'utf-8')\n\n    @text.setter\n    def text(self, text):\n        if text is not None and not isinstance(text, str):\n            raise TypeError('text argument must be str (%r)' % type(text))\n\n        if self.content_type == 'application/octet-stream':\n            self.content_type = 'text/plain'\n        if self.charset is None:\n            self.charset = 'utf-8'\n\n        self.body = text.encode(self.charset)\n\n    @asyncio.coroutine\n    def write_eof(self):\n        body = self._body\n        if body is not None:\n            self.write(body)\n        yield from super().write_eof()\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Incorrect Parsing of URLs with Double Slashes in Path**

**Description**
When a URL containing double slashes in the path is parsed, the resulting path is incorrectly set to a single slash. This causes the application to misinterpret the intended path structure.

For example, parsing the URL `http://example.com//foo/` results in the path being `/` instead of the expected `//foo/`.

```python
def test_doubleslashes(self):
    req = self.make_request('GET', '//foo/')
    print(req.path)  # Outputs: '/'
```

**Expected Behavior**
The path should retain the double slashes, resulting in `//foo/`, accurately reflecting the original URL structure.

**Actual Behavior**
The path is incorrectly parsed as `/`, ignoring the double slashes and leading to potential routing and resource access issues.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### aiohttp/web_reqrep.py
__all__ = ('ContentCoding', 'Request', 'StreamResponse', 'Response')

import asyncio
import binascii
import cgi
import collections
import datetime
import http.cookies
import io
import json
import math
import time
import warnings

import enum

from email.utils import parsedate
from types import MappingProxyType
from urllib.parse import urlsplit, parse_qsl, unquote

from . import hdrs
from .helpers import reify
from .multidict import (CIMultiDictProxy,
                        CIMultiDict,
                        MultiDictProxy,
                        MultiDict)
from .protocol import Response as ResponseImpl, HttpVersion10
from .streams import EOF_MARKER


sentinel = object()


class HeadersMixin:

    _content_type = None
    _content_dict = None
    _stored_content_type = sentinel

    def _parse_content_type(self, raw):
        self._stored_content_type = raw
        if raw is None:
            # default value according to RFC 2616
            self._content_type = 'application/octet-stream'
            self._content_dict = {}
        else:
            self._content_type, self._content_dict = cgi.parse_header(raw)

    @property
    def content_type(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):
        """The value of content part for Content-Type HTTP header."""
        raw = self.headers.get(_CONTENT_TYPE)
        if self._stored_content_type != raw:
            self._parse_content_type(raw)
        return self._content_type

    @property
    def charset(self, _CONTENT_TYPE=hdrs.CONTENT_TYPE):
        """The value of charset part for Content-Type HTTP header."""
        raw = self.headers.get(_CONTENT_TYPE)
        if self._stored_content_type != raw:
            self._parse_content_type(raw)
        return self._content_dict.get('charset')

    @property
    def content_length(self, _CONTENT_LENGTH=hdrs.CONTENT_LENGTH):
        """The value of Content-Length HTTP header."""
        l = self.headers.get(_CONTENT_LENGTH)
        if l is None:
            return None
        else:
            return int(l)

FileField = collections.namedtuple('Field', 'name filename file content_type')


class ContentCoding(enum.Enum):
    # The content codings that we have support for.
    #
    # Additional registered codings are listed at:
    # https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding
    deflate = 'deflate'
    gzip = 'gzip'
    identity = 'identity'


############################################################
# HTTP Request
############################################################


class Request(dict, HeadersMixin):

    POST_METHODS = {hdrs.METH_PATCH, hdrs.METH_POST, hdrs.METH_PUT,
                    hdrs.METH_TRACE, hdrs.METH_DELETE}

    def __init__(self, app, message, payload, transport, reader, writer, *,
                 _HOST=hdrs.HOST, secure_proxy_ssl_header=None):
        self._app = app
        self._version = message.version
        self._transport = transport
        self._reader = reader
        self._writer = writer
        self._method = message.method
        self._host = message.headers.get(_HOST)
        self._path_qs = message.path
        self._post = None
        self._post_files_cache = None
        self._headers = CIMultiDictProxy(message.headers)
        if self._version < HttpVersion10:
            self._keep_alive = False
        else:
            self._keep_alive = not message.should_close

        # matchdict, route_name, handler
        # or information about traversal lookup
        self._match_info = None  # initialized after route resolving

        self._payload = payload
        self._cookies = None

        self._read_bytes = None
        self._has_body = not payload.at_eof()

        self._secure_proxy_ssl_header = secure_proxy_ssl_header

    @property
    def scheme(self):
        """A string representing the scheme of the request.

        'http' or 'https'.
        """
        if self._transport.get_extra_info('sslcontext'):
            return 'https'
        secure_proxy_ssl_header = self._secure_proxy_ssl_header
        if secure_proxy_ssl_header is not None:
            header, value = secure_proxy_ssl_header
            if self._headers.get(header) == value:
                return 'https'
        return 'http'

    @property
    def method(self):
        """Read only property for getting HTTP method.

        The value is upper-cased str like 'GET', 'POST', 'PUT' etc.
        """
        return self._method

    @property
    def version(self):
        """Read only property for getting HTTP version of request.

        Returns aiohttp.protocol.HttpVersion instance.
        """
        return self._version

    @property
    def host(self):
        """Read only property for getting *HOST* header of request.

        Returns str or None if HTTP request has no HOST header.
        """
        return self._host

    @property
    def path_qs(self):
        """The URL including PATH_INFO and the query string.

        E.g, /app/blog?id=10
        """
        return self._path_qs

    @reify
    def _splitted_path(self):
        return urlsplit(self._path_qs)

    @property
    def raw_path(self):
        """ The URL including raw *PATH INFO* without the host or scheme.
        Warning, the path is unquoted and may contains non valid URL characters

        E.g., ``/my%2Fpath%7Cwith%21some%25strange%24characters``
        """
        return self._splitted_path.path

    @reify
    def path(self):
        """The URL including *PATH INFO* without the host or scheme.

        E.g., ``/app/blog``
        """
        return unquote(self.raw_path)

    @reify
    def query_string(self):
        """The query string in the URL.

        E.g., id=10
        """
        return self._splitted_path.query

    @reify
    def GET(self):
        """A multidict with all the variables in the query string.

        Lazy property.
        """
        return MultiDictProxy(MultiDict(parse_qsl(self.query_string,
                                                  keep_blank_values=True)))

    @reify
    def POST(self):
        """A multidict with all the variables in the POST parameters.

        post() methods has to be called before using this attribute.
        """
        if self._post is None:
            raise RuntimeError("POST is not available before post()")
        return self._post

    @property
    def headers(self):
        """A case-insensitive multidict proxy with all headers."""
        return self._headers

    @property
    def if_modified_since(self, _IF_MODIFIED_SINCE=hdrs.IF_MODIFIED_SINCE):
        """The value of If-Modified-Since HTTP header, or None.

        This header is represented as a `datetime` object.
        """
        httpdate = self.headers.get(_IF_MODIFIED_SINCE)
        if httpdate is not None:
            timetuple = parsedate(httpdate)
            if timetuple is not None:
                return datetime.datetime(*timetuple[:6],
                                         tzinfo=datetime.timezone.utc)
        return None

    @property
    def keep_alive(self):
        """Is keepalive enabled by client?"""
        return self._keep_alive

    @property
    def match_info(self):
        """Result of route resolving."""
        return self._match_info

    @property
    def app(self):
        """Application instance."""
        return self._app

    @property
    def transport(self):
        """Transport used for request processing."""
        return self._transport

    @property
    def cookies(self):
        """Return request cookies.

        A read-only dictionary-like object.
        """
        if self._cookies is None:
            raw = self.headers.get(hdrs.COOKIE, '')
            parsed = http.cookies.SimpleCookie(raw)
            self._cookies = MappingProxyType(
                {key: val.value for key, val in parsed.items()})
        return self._cookies

    @property
    def payload(self):
        """Return raw payload stream."""
        warnings.warn('use Request.content instead', DeprecationWarning)
        return self._payload

    @property
    def content(self):
        """Return raw payload stream."""
        return self._payload

    @property
    def has_body(self):
        """Return True if request has HTTP BODY, False otherwise."""
        return self._has_body

    @asyncio.coroutine
    def release(self):
        """Release request.

        Eat unread part of HTTP BODY if present.
        """
        chunk = yield from self._payload.readany()
        while chunk is not EOF_MARKER or chunk:
            chunk = yield from self._payload.readany()

    @asyncio.coroutine
    def read(self):
        """Read request body if present.

        Returns bytes object with full request content.
        """
        if self._read_bytes is None:
            body = bytearray()
            while True:
                chunk = yield from self._payload.readany()
                body.extend(chunk)
                if chunk is EOF_MARKER:
                    break
            self._read_bytes = bytes(body)
        return self._read_bytes

    @asyncio.coroutine
    def text(self):
        """Return BODY as text using encoding from .charset."""
        bytes_body = yield from self.read()
        encoding = self.charset or 'utf-8'
        return bytes_body.decode(encoding)

    @asyncio.coroutine
    def json(self, *, loader=json.loads):
        """Return BODY as JSON."""
        body = yield from self.text()
        return loader(body)

    @asyncio.coroutine
    def post(self):
        """Return POST parameters."""
        if self._post is not None:
            return self._post
        if self.method not in self.POST_METHODS:
            self._post = MultiDictProxy(MultiDict())
            return self._post

        content_type = self.content_type
        if (content_type not in ('',
                                 'application/x-www-form-urlencoded',
                                 'multipart/form-data')):
            self._post = MultiDictProxy(MultiDict())
            return self._post

        body = yield from self.read()
        content_charset = self.charset or 'utf-8'

        environ = {'REQUEST_METHOD': self.method,
                   'CONTENT_LENGTH': str(len(body)),
                   'QUERY_STRING': '',
                   'CONTENT_TYPE': self.headers.get(hdrs.CONTENT_TYPE)}

        fs = cgi.FieldStorage(fp=io.BytesIO(body),
                              environ=environ,
                              keep_blank_values=True,
                              encoding=content_charset)

        supported_transfer_encoding = {
            'base64': binascii.a2b_base64,
            'quoted-printable': binascii.a2b_qp
        }

        out = MultiDict()
        _count = 1
        for field in fs.list or ():
            transfer_encoding = field.headers.get(
                hdrs.CONTENT_TRANSFER_ENCODING, None)
            if field.filename:
                ff = FileField(field.name,
                               field.filename,
                               field.file,  # N.B. file closed error
                               field.type)
                if self._post_files_cache is None:
                    self._post_files_cache = {}
                self._post_files_cache[field.name+str(_count)] = field
                _count += 1
                out.add(field.name, ff)
            else:
                value = field.value
                if transfer_encoding in supported_transfer_encoding:
                    # binascii accepts bytes
                    value = value.encode('utf-8')
                    value = supported_transfer_encoding[
                        transfer_encoding](value)
                out.add(field.name, value)

        self._post = MultiDictProxy(out)
        return self._post

    def __repr__(self):
        return "<{} {} {} >".format(self.__class__.__name__,
                                    self.method, self.path)


############################################################
# HTTP Response classes
############################################################


class StreamResponse(HeadersMixin):

    def __init__(self, *, status=200, reason=None, headers=None):
        self._body = None
        self._keep_alive = None
        self._chunked = False
        self._chunk_size = None
        self._compression = False
        self._compression_force = False
        self._headers = CIMultiDict()
        self._cookies = http.cookies.SimpleCookie()
        self.set_status(status, reason)

        self._req = None
        self._resp_impl = None
        self._eof_sent = False

        if headers is not None:
            self._headers.extend(headers)

    def _copy_cookies(self):
        for cookie in self._cookies.values():
            value = cookie.output(header='')[1:]
            self.headers.add(hdrs.SET_COOKIE, value)

    @property
    def started(self):
        return self._resp_impl is not None

    @property
    def status(self):
        return self._status

    @property
    def chunked(self):
        return self._chunked

    @property
    def compression(self):
        return self._compression

    @property
    def reason(self):
        return self._reason

    def set_status(self, status, reason=None):
        self._status = int(status)
        if reason is None:
            reason = ResponseImpl.calc_reason(status)
        self._reason = reason

    @property
    def keep_alive(self):
        return self._keep_alive

    def force_close(self):
        self._keep_alive = False

    def enable_chunked_encoding(self, chunk_size=None):
        """Enables automatic chunked transfer encoding."""
        self._chunked = True
        self._chunk_size = chunk_size

    def enable_compression(self, force=None):
        """Enables response compression encoding."""
        # Backwards compatibility for when force was a bool <0.17.
        if type(force) == bool:
            force = ContentCoding.deflate if force else ContentCoding.identity

        self._compression = True
        self._compression_force = force

    @property
    def headers(self):
        return self._headers

    @property
    def cookies(self):
        return self._cookies

    def set_cookie(self, name, value, *, expires=None,
                   domain=None, max_age=None, path='/',
                   secure=None, httponly=None, version=None):
        """Set or update response cookie.

        Sets new cookie or updates existent with new value.
        Also updates only those params which are not None.
        """

        old = self._cookies.get(name)
        if old is not None and old.coded_value == '':
            # deleted cookie
            self._cookies.pop(name, None)

        self._cookies[name] = value
        c = self._cookies[name]
        if expires is not None:
            c['expires'] = expires
        if domain is not None:
            c['domain'] = domain
        if max_age is not None:
            c['max-age'] = max_age
        if path is not None:
            c['path'] = path
        if secure is not None:
            c['secure'] = secure
        if httponly is not None:
            c['httponly'] = httponly
        if version is not None:
            c['version'] = version

    def del_cookie(self, name, *, domain=None, path='/'):
        """Delete cookie.

        Creates new empty expired cookie.
        """
        # TODO: do we need domain/path here?
        self._cookies.pop(name, None)
        self.set_cookie(name, '', max_age=0, domain=domain, path=path)

    @property
    def content_length(self):
        # Just a placeholder for adding setter
        return super().content_length

    @content_length.setter
    def content_length(self, value):
        if value is not None:
            value = int(value)
            # TODO: raise error if chunked enabled
            self.headers[hdrs.CONTENT_LENGTH] = str(value)
        else:
            self.headers.pop(hdrs.CONTENT_LENGTH, None)

    @property
    def content_type(self):
        # Just a placeholder for adding setter
        return super().content_type

    @content_type.setter
    def content_type(self, value):
        self.content_type  # read header values if needed
        self._content_type = str(value)
        self._generate_content_type_header()

    @property
    def charset(self):
        # Just a placeholder for adding setter
        return super().charset

    @charset.setter
    def charset(self, value):
        ctype = self.content_type  # read header values if needed
        if ctype == 'application/octet-stream':
            raise RuntimeError("Setting charset for application/octet-stream "
                               "doesn't make sense, setup content_type first")
        if value is None:
            self._content_dict.pop('charset', None)
        else:
            self._content_dict['charset'] = str(value).lower()
        self._generate_content_type_header()

    @property
    def last_modified(self, _LAST_MODIFIED=hdrs.LAST_MODIFIED):
        """The value of Last-Modified HTTP header, or None.

        This header is represented as a `datetime` object.
        """
        httpdate = self.headers.get(_LAST_MODIFIED)
        if httpdate is not None:
            timetuple = parsedate(httpdate)
            if timetuple is not None:
                return datetime.datetime(*timetuple[:6],
                                         tzinfo=datetime.timezone.utc)
        return None

    @last_modified.setter
    def last_modified(self, value):
        if value is None:
            if hdrs.LAST_MODIFIED in self.headers:
                del self.headers[hdrs.LAST_MODIFIED]
        elif isinstance(value, (int, float)):
            self.headers[hdrs.LAST_MODIFIED] = time.strftime(
                "%a, %d %b %Y %H:%M:%S GMT", time.gmtime(math.ceil(value)))
        elif isinstance(value, datetime.datetime):
            self.headers[hdrs.LAST_MODIFIED] = time.strftime(
                "%a, %d %b %Y %H:%M:%S GMT", value.utctimetuple())
        elif isinstance(value, str):
            self.headers[hdrs.LAST_MODIFIED] = value

    def _generate_content_type_header(self, CONTENT_TYPE=hdrs.CONTENT_TYPE):
        params = '; '.join("%s=%s" % i for i in self._content_dict.items())
        if params:
            ctype = self._content_type + '; ' + params
        else:
            ctype = self._content_type
        self.headers[CONTENT_TYPE] = ctype

    def _start_pre_check(self, request):
        if self._resp_impl is not None:
            if self._req is not request:
                raise RuntimeError(
                    'Response has been started with different request.')
            else:
                return self._resp_impl
        else:
            return None

    def _start_compression(self, request):
        def start(coding):
            if coding != ContentCoding.identity:
                self.headers[hdrs.CONTENT_ENCODING] = coding.value
                self._resp_impl.add_compression_filter(coding.value)
                self.content_length = None

        if self._compression_force:
            start(self._compression_force)
        else:
            accept_encoding = request.headers.get(
                hdrs.ACCEPT_ENCODING, '').lower()
            for coding in ContentCoding:
                if coding.value in accept_encoding:
                    start(coding)
                    return

    def start(self, request):
        resp_impl = self._start_pre_check(request)
        if resp_impl is not None:
            return resp_impl

        self._req = request
        keep_alive = self._keep_alive
        if keep_alive is None:
            keep_alive = request.keep_alive
        self._keep_alive = keep_alive

        resp_impl = self._resp_impl = ResponseImpl(
            request._writer,
            self._status,
            request.version,
            not keep_alive,
            self._reason)

        self._copy_cookies()

        if self._compression:
            self._start_compression(request)

        if self._chunked:
            resp_impl.enable_chunked_encoding()
            if self._chunk_size:
                resp_impl.add_chunking_filter(self._chunk_size)

        headers = self.headers.items()
        for key, val in headers:
            resp_impl.add_header(key, val)

        resp_impl.send_headers()
        return resp_impl

    def write(self, data):
        assert isinstance(data, (bytes, bytearray, memoryview)), \
            'data argument must be byte-ish (%r)' % type(data)

        if self._eof_sent:
            raise RuntimeError("Cannot call write() after write_eof()")
        if self._resp_impl is None:
            raise RuntimeError("Cannot call write() before start()")

        if data:
            return self._resp_impl.write(data)
        else:
            return ()

    @asyncio.coroutine
    def drain(self):
        if self._resp_impl is None:
            raise RuntimeError("Response has not been started")
        yield from self._resp_impl.transport.drain()

    @asyncio.coroutine
    def write_eof(self):
        if self._eof_sent:
            return
        if self._resp_impl is None:
            raise RuntimeError("Response has not been started")

        yield from self._resp_impl.write_eof()
        self._eof_sent = True

    def __repr__(self):
        if self.started:
            info = "{} {} ".format(self._req.method, self._req.path)
        else:
            info = "not started"
        return "<{} {} {}>".format(self.__class__.__name__,
                                   self.reason, info)


class Response(StreamResponse):

    def __init__(self, *, body=None, status=200,
                 reason=None, text=None, headers=None, content_type=None):
        super().__init__(status=status, reason=reason, headers=headers)

        if body is not None and text is not None:
            raise ValueError("body and text are not allowed together.")

        if text is not None:
            if hdrs.CONTENT_TYPE not in self.headers:
                # fast path for filling headers
                if not isinstance(text, str):
                    raise TypeError('text argument must be str (%r)' %
                                    type(text))
                if content_type is None:
                    content_type = 'text/plain'
                self.headers[hdrs.CONTENT_TYPE] = (
                    content_type + '; charset=utf-8')
                self._content_type = content_type
                self._content_dict = {'charset': 'utf-8'}
                self.body = text.encode('utf-8')
            else:
                self.text = text
        else:
            if content_type:
                self.content_type = content_type
            if body is not None:
                self.body = body
            else:
                self.body = None

    @property
    def body(self):
        return self._body

    @body.setter
    def body(self, body):
        if body is not None and not isinstance(body, bytes):
            raise TypeError('body argument must be bytes (%r)' % type(body))
        self._body = body
        if body is not None:
            self.content_length = len(body)
        else:
            self.content_length = 0

    @property
    def text(self):
        if self._body is None:
            return None
        return self._body.decode(self.charset or 'utf-8')

    @text.setter
    def text(self, text):
        if text is not None and not isinstance(text, str):
            raise TypeError('text argument must be str (%r)' % type(text))

        if self.content_type == 'application/octet-stream':
            self.content_type = 'text/plain'
        if self.charset is None:
            self.charset = 'utf-8'

        self.body = text.encode(self.charset)

    @asyncio.coroutine
    def write_eof(self):
        body = self._body
        if body is not None:
            self.write(body)
        yield from super().write_eof()

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user