{
    "file_diffs": [
        {
            "old_file_content": "CHANGES\n=======\n\n0.10.1 (XX-XX-XXXX)\n-------------------\n\n- aiohttp.web.HTTPException and descendants now files response body\n  with string like `400: NotFound`\n\n0.10.0 (11-13-2014)\n-------------------\n\n- Add aiohttp.web subpackage for highlevel http server support.\n\n- Add *reason* optional parameter to aiohttp.protocol.Response ctor.\n\n- Fix aiohttp.client bug for sending file without content-type.\n\n- Change error text for connection closed between server responses\n  from 'Can not read status line' to explicit 'Connection closed by\n  server'\n\n- Drop closed connections from connector #173\n\n- Set server.transport to None on .closing() #172\n\n0.9.3 (10-30-2014)\n------------------\n\n- Fix compatibility with asyncio 3.4.1+ #170\n\n0.9.2 (10-16-2014)\n------------------\n\n- Improve redirect handling #157\n\n- Send raw files as is #153\n\n- Better websocket support #150\n\n\n0.9.1 (08-30-2014)\n------------------\n\n- Added MultiDict support for client request params and data #114.\n\n- Fixed parameter type for IncompleteRead exception #118.\n\n- Strictly require ASCII headers names and values #137\n\n- Keep port in ProxyConnector #128.\n\n- Python 3.4.1 compatibility #131.\n\n\n0.9.0 (07-08-2014)\n------------------\n\n- Better client basic authentication support #112.\n\n- Fixed incorrect line splitting in HttpRequestParser #97.\n\n- Support StreamReader and DataQueue as request data.\n\n- Client files handling refactoring #20.\n\n- Backward incompatible: Replace DataQueue with StreamReader for request payload #87.\n\n\n0.8.4 (07-04-2014)\n------------------\n\n- Change ProxyConnector authorization parameters.\n\n\n0.8.3 (07-03-2014)\n------------------\n\n- Publish TCPConnector properties: verify_ssl, family, resolve, resolved_hosts.\n\n- Don't parse message body for HEAD responses.\n\n- Refactor client response decoding.\n\n\n0.8.2 (06-22-2014)\n------------------\n\n- Make ProxyConnector.proxy immutable property.\n\n- Make UnixConnector.path immutable property.\n\n- Fix resource leak for aiohttp.request() with implicit connector.\n\n- Rename Connector's reuse_timeout to keepalive_timeout.\n\n\n0.8.1 (06-18-2014)\n------------------\n\n- Use case insensitive multidict for server request/response headers.\n\n- MultiDict.getall() accepts default value.\n\n- Catch server ConnectionError.\n\n- Accept MultiDict (and derived) instances in aiohttp.request header argument.\n\n- Proxy 'CONNECT' support.\n\n\n0.8.0 (06-06-2014)\n------------------\n\n- Add support for utf-8 values in HTTP headers\n\n- Allow to use custom response class instead of HttpResponse\n\n- Use MultiDict for client request headers\n\n- Use MultiDict for server request/response headers\n\n- Store response headers in ClientResponse.headers attribute\n\n- Get rid of timeout parameter in aiohttp.client API\n\n- Exceptions refactoring\n\n\n0.7.3 (05-20-2014)\n------------------\n\n- Simple HTTP proxy support.\n\n\n0.7.2 (05-14-2014)\n------------------\n\n- Get rid of __del__ methods\n\n- Use ResourceWarning instead of logging warning record.\n\n\n0.7.1 (04-28-2014)\n------------------\n\n- Do not unquote client request urls.\n\n- Allow multple waiters on transport drain.\n\n- Do not return client connection to pool in case of exceptions.\n\n- Rename SocketConnector to TCPConnector and UnixSocketConnector to UnixConnector.\n\n\n0.7.0 (04-16-2014)\n------------------\n\n- Connection flow control.\n\n- Http client session/connection pool refactoring.\n\n- Better handling for bad server requests.\n\n\n0.6.5 (03-29-2014)\n------------------\n\n- Added client session reuse timeout.\n\n- Better client request cancellation support.\n\n- Better handling responses without content length.\n\n- Added HttpClient verify_ssl parameter support.\n\n\n0.6.4 (02-27-2014)\n------------------\n\n- Log content-length missing warning only for put and post requests.\n\n\n0.6.3 (02-27-2014)\n------------------\n\n- Better support for server exit.\n\n- Read response body until eof if content-length is not defined #14\n\n\n0.6.2 (02-18-2014)\n------------------\n\n- Fix trailing char in allowed_methods.\n\n- Start slow request timer for first request.\n\n\n0.6.1 (02-17-2014)\n------------------\n\n- Added utility method HttpResponse.read_and_close()\n\n- Added slow request timeout.\n\n- Enable socket SO_KEEPALIVE if available. (@polymorphm)\n\n\n0.6.0 (02-12-2014)\n------------------\n\n- Better handling for process exit.\n\n\n0.5.0 (01-29-2014)\n------------------\n\n- Allow to use custom HttpRequest client class.\n\n- Use gunicorn keepalive setting for async worker.\n\n- Log leaking responses.\n\n- python 3.4 compatibility\n\n\n0.4.4 (11-15-2013)\n------------------\n\n- Resolve only AF_INET family, because it is not clear how to pass extra info to asyncio.\n\n\n0.4.3 (11-15-2013)\n------------------\n\n- Allow to wait completion of request with `HttpResponse.wait_for_close()`\n\n\n0.4.2 (11-14-2013)\n------------------\n\n- Handle exception in client request stream.\n\n- Prevent host resolving for each client request.\n\n\n0.4.1 (11-12-2013)\n------------------\n\n- Added client support for `expect: 100-continue` header.\n\n\n0.4 (11-06-2013)\n----------------\n\n- Added custom wsgi application close procedure\n\n- Fixed concurrent host failure in HttpClient\n\n\n0.3 (11-04-2013)\n----------------\n\n- Added PortMapperWorker\n\n- Added HttpClient\n\n- Added tcp connection timeout to http client\n\n- Better client connection errors handling\n\n- Gracefully handle process exit\n\n\n0.2\n---\n\n- Fix packaging\n",
            "new_file_content": "CHANGES\n=======\n\n0.10.1 (XX-XX-XXXX)\n-------------------\n\n- aiohttp.web.HTTPException and descendants now files response body\n  with string like `400: NotFound`\n\n- Fix multidict __iter__, the method should iterate over keys, not (key, value) pairs.\n\n0.10.0 (11-13-2014)\n-------------------\n\n- Add aiohttp.web subpackage for highlevel http server support.\n\n- Add *reason* optional parameter to aiohttp.protocol.Response ctor.\n\n- Fix aiohttp.client bug for sending file without content-type.\n\n- Change error text for connection closed between server responses\n  from 'Can not read status line' to explicit 'Connection closed by\n  server'\n\n- Drop closed connections from connector #173\n\n- Set server.transport to None on .closing() #172\n\n0.9.3 (10-30-2014)\n------------------\n\n- Fix compatibility with asyncio 3.4.1+ #170\n\n0.9.2 (10-16-2014)\n------------------\n\n- Improve redirect handling #157\n\n- Send raw files as is #153\n\n- Better websocket support #150\n\n\n0.9.1 (08-30-2014)\n------------------\n\n- Added MultiDict support for client request params and data #114.\n\n- Fixed parameter type for IncompleteRead exception #118.\n\n- Strictly require ASCII headers names and values #137\n\n- Keep port in ProxyConnector #128.\n\n- Python 3.4.1 compatibility #131.\n\n\n0.9.0 (07-08-2014)\n------------------\n\n- Better client basic authentication support #112.\n\n- Fixed incorrect line splitting in HttpRequestParser #97.\n\n- Support StreamReader and DataQueue as request data.\n\n- Client files handling refactoring #20.\n\n- Backward incompatible: Replace DataQueue with StreamReader for request payload #87.\n\n\n0.8.4 (07-04-2014)\n------------------\n\n- Change ProxyConnector authorization parameters.\n\n\n0.8.3 (07-03-2014)\n------------------\n\n- Publish TCPConnector properties: verify_ssl, family, resolve, resolved_hosts.\n\n- Don't parse message body for HEAD responses.\n\n- Refactor client response decoding.\n\n\n0.8.2 (06-22-2014)\n------------------\n\n- Make ProxyConnector.proxy immutable property.\n\n- Make UnixConnector.path immutable property.\n\n- Fix resource leak for aiohttp.request() with implicit connector.\n\n- Rename Connector's reuse_timeout to keepalive_timeout.\n\n\n0.8.1 (06-18-2014)\n------------------\n\n- Use case insensitive multidict for server request/response headers.\n\n- MultiDict.getall() accepts default value.\n\n- Catch server ConnectionError.\n\n- Accept MultiDict (and derived) instances in aiohttp.request header argument.\n\n- Proxy 'CONNECT' support.\n\n\n0.8.0 (06-06-2014)\n------------------\n\n- Add support for utf-8 values in HTTP headers\n\n- Allow to use custom response class instead of HttpResponse\n\n- Use MultiDict for client request headers\n\n- Use MultiDict for server request/response headers\n\n- Store response headers in ClientResponse.headers attribute\n\n- Get rid of timeout parameter in aiohttp.client API\n\n- Exceptions refactoring\n\n\n0.7.3 (05-20-2014)\n------------------\n\n- Simple HTTP proxy support.\n\n\n0.7.2 (05-14-2014)\n------------------\n\n- Get rid of __del__ methods\n\n- Use ResourceWarning instead of logging warning record.\n\n\n0.7.1 (04-28-2014)\n------------------\n\n- Do not unquote client request urls.\n\n- Allow multple waiters on transport drain.\n\n- Do not return client connection to pool in case of exceptions.\n\n- Rename SocketConnector to TCPConnector and UnixSocketConnector to UnixConnector.\n\n\n0.7.0 (04-16-2014)\n------------------\n\n- Connection flow control.\n\n- Http client session/connection pool refactoring.\n\n- Better handling for bad server requests.\n\n\n0.6.5 (03-29-2014)\n------------------\n\n- Added client session reuse timeout.\n\n- Better client request cancellation support.\n\n- Better handling responses without content length.\n\n- Added HttpClient verify_ssl parameter support.\n\n\n0.6.4 (02-27-2014)\n------------------\n\n- Log content-length missing warning only for put and post requests.\n\n\n0.6.3 (02-27-2014)\n------------------\n\n- Better support for server exit.\n\n- Read response body until eof if content-length is not defined #14\n\n\n0.6.2 (02-18-2014)\n------------------\n\n- Fix trailing char in allowed_methods.\n\n- Start slow request timer for first request.\n\n\n0.6.1 (02-17-2014)\n------------------\n\n- Added utility method HttpResponse.read_and_close()\n\n- Added slow request timeout.\n\n- Enable socket SO_KEEPALIVE if available. (@polymorphm)\n\n\n0.6.0 (02-12-2014)\n------------------\n\n- Better handling for process exit.\n\n\n0.5.0 (01-29-2014)\n------------------\n\n- Allow to use custom HttpRequest client class.\n\n- Use gunicorn keepalive setting for async worker.\n\n- Log leaking responses.\n\n- python 3.4 compatibility\n\n\n0.4.4 (11-15-2013)\n------------------\n\n- Resolve only AF_INET family, because it is not clear how to pass extra info to asyncio.\n\n\n0.4.3 (11-15-2013)\n------------------\n\n- Allow to wait completion of request with `HttpResponse.wait_for_close()`\n\n\n0.4.2 (11-14-2013)\n------------------\n\n- Handle exception in client request stream.\n\n- Prevent host resolving for each client request.\n\n\n0.4.1 (11-12-2013)\n------------------\n\n- Added client support for `expect: 100-continue` header.\n\n\n0.4 (11-06-2013)\n----------------\n\n- Added custom wsgi application close procedure\n\n- Fixed concurrent host failure in HttpClient\n\n\n0.3 (11-04-2013)\n----------------\n\n- Added PortMapperWorker\n\n- Added HttpClient\n\n- Added tcp connection timeout to http client\n\n- Better client connection errors handling\n\n- Gracefully handle process exit\n\n\n0.2\n---\n\n- Fix packaging\n",
            "header": {
                "file": {
                    "path": "CHANGES.txt"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "50612282",
                "new_commit_hash": "71fbc8e4",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/CHANGES.txt"
            },
            "plus_file": {
                "path": "b/CHANGES.txt"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 7,
                            "length": 6
                        },
                        "new_range": {
                            "start": 7,
                            "length": 8
                        },
                        "section": "CHANGES"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "- aiohttp.web.HTTPException and descendants now files response body",
                                "type": "context"
                            },
                            {
                                "content": "  with string like `400: NotFound`",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "- Fix multidict __iter__, the method should iterate over keys, not (key, value) pairs.",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "0.10.0 (11-13-2014)",
                                "type": "context"
                            },
                            {
                                "content": "-------------------",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import pprint\nfrom itertools import chain, filterfalse\nfrom collections import abc\n\n_marker = object()\n\n\ndef _unique_everseen(iterable):\n    \"\"\"List unique elements, preserving order.\n    Remember all elements ever seen.\n    Recipe from\n    https://docs.python.org/3/library/itertools.html#itertools-recipes\"\"\"\n    # unique_everseen('AAAABBBCCDAABBB') --> A B C D\n    # unique_everseen('ABBCcAD', str.lower) --> A B C D\n    seen = set()\n    seen_add = seen.add\n    for element in filterfalse(seen.__contains__, iterable):\n        seen_add(element)\n        yield element\n\n\nclass MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self._items)\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )\n\n\nclass CaseInsensitiveMultiDict(MultiDict):\n    \"\"\"Case insensitive multi dict.\"\"\"\n\n    @classmethod\n    def _from_uppercase_multidict(cls, dct):\n        # NB: doesn't check for uppercase keys!\n        ret = cls.__new__(cls)\n        ret._items = dct._items\n        return ret\n\n    def _fill(self, ipairs):\n        for key, value in ipairs:\n            uppkey = key.upper()\n            self._items.append((uppkey, value))\n\n    def getall(self, key, default=_marker):\n        return super().getall(key.upper(), default)\n\n    def getone(self, key, default=_marker):\n        return super().getone(key.upper(), default)\n\n    def __getitem__(self, key):\n        return super().__getitem__(key.upper())\n\n    def __contains__(self, key):\n        return super().__contains__(key.upper())\n\n\nclass MutableMultiDictMixin(abc.MutableMapping):\n\n    def add(self, key, value):\n        \"\"\"\n        Add the key and value, not overwriting any previous value.\n        \"\"\"\n        self._items.append((key, value))\n\n    def extend(self, *args, **kwargs):\n        \"\"\"Extends current MutableMultiDict with more values.\n\n        This method must be used instead of update.\n        \"\"\"\n        if len(args) > 1:\n            raise TypeError(\"extend takes at most 2 positional arguments\"\n                            \" ({} given)\".format(len(args) + 1))\n        if args:\n            if isinstance(args[0], MultiDict):\n                items = args[0].items(getall=True)\n            elif hasattr(args[0], 'items'):\n                items = args[0].items()\n            else:\n                items = args[0]\n        else:\n            items = []\n        for key, value in chain(items, kwargs.items()):\n            self.add(key, value)\n\n    def clear(self):\n        \"\"\"Remove all items from MutableMultiDict\"\"\"\n        self._items.clear()\n\n    # MutableMapping interface #\n\n    def __setitem__(self, key, value):\n        try:\n            del self[key]\n        except KeyError:\n            pass\n        self._items.append((key, value))\n\n    def __delitem__(self, key):\n        items = self._items\n        found = False\n        for i in range(len(items)-1, -1, -1):\n            if items[i][0] == key:\n                del items[i]\n                found = True\n        if not found:\n            raise KeyError(key)\n\n    def pop(self, key, default=None):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def popitem(self):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def update(self, *args, **kw):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError(\"Use extend method instead\")\n\n\nclass MutableMultiDict(MutableMultiDictMixin, MultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n\nclass CaseInsensitiveMutableMultiDict(\n        MutableMultiDictMixin, CaseInsensitiveMultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n    def add(self, key, value):\n        super().add(key.upper(), value)\n\n    def __setitem__(self, key, value):\n        super().__setitem__(key.upper(), value)\n\n    def __delitem__(self, key):\n        super().__delitem__(key.upper())\n\n\nclass _ViewBase:\n\n    def __init__(self, items, *, getall=False):\n        self._getall = getall\n        self._keys = [item[0] for item in items]\n        if not getall:\n            self._keys = list(_unique_everseen(self._keys))\n\n        items_to_use = []\n        if getall:\n            items_to_use = items\n        else:\n            for key in self._keys:\n                for k, v in items:\n                    if k == key:\n                        items_to_use.append((k, v))\n                        break\n        assert len(items_to_use) == len(self._keys)\n\n        super().__init__(items_to_use)\n\n\nclass _ItemsView(_ViewBase, abc.ItemsView):\n\n    def __contains__(self, item):\n        assert isinstance(item, tuple) or isinstance(item, list)\n        assert len(item) == 2\n        return item in self._mapping\n\n    def __iter__(self):\n        yield from self._mapping\n\n\nclass _ValuesView(_ViewBase, abc.ValuesView):\n\n    def __contains__(self, value):\n        for item in self._mapping:\n            if item[1] == value:\n                return True\n        return False\n\n    def __iter__(self):\n        for item in self._mapping:\n            yield item[1]\n\n\nclass _KeysView(_ViewBase, abc.KeysView):\n\n    def __contains__(self, key):\n        return key in self._keys\n\n    def __iter__(self):\n        yield from self._keys\n",
            "new_file_content": "import pprint\nfrom itertools import chain, filterfalse\nfrom collections import abc\n\n_marker = object()\n\n\ndef _unique_everseen(iterable):\n    \"\"\"List unique elements, preserving order.\n    Remember all elements ever seen.\n    Recipe from\n    https://docs.python.org/3/library/itertools.html#itertools-recipes\"\"\"\n    # unique_everseen('AAAABBBCCDAABBB') --> A B C D\n    # unique_everseen('ABBCcAD', str.lower) --> A B C D\n    seen = set()\n    seen_add = seen.add\n    for element in filterfalse(seen.__contains__, iterable):\n        seen_add(element)\n        yield element\n\n\nclass MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self.keys())\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )\n\n\nclass CaseInsensitiveMultiDict(MultiDict):\n    \"\"\"Case insensitive multi dict.\"\"\"\n\n    @classmethod\n    def _from_uppercase_multidict(cls, dct):\n        # NB: doesn't check for uppercase keys!\n        ret = cls.__new__(cls)\n        ret._items = dct._items\n        return ret\n\n    def _fill(self, ipairs):\n        for key, value in ipairs:\n            uppkey = key.upper()\n            self._items.append((uppkey, value))\n\n    def getall(self, key, default=_marker):\n        return super().getall(key.upper(), default)\n\n    def getone(self, key, default=_marker):\n        return super().getone(key.upper(), default)\n\n    def __getitem__(self, key):\n        return super().__getitem__(key.upper())\n\n    def __contains__(self, key):\n        return super().__contains__(key.upper())\n\n\nclass MutableMultiDictMixin(abc.MutableMapping):\n\n    def add(self, key, value):\n        \"\"\"\n        Add the key and value, not overwriting any previous value.\n        \"\"\"\n        self._items.append((key, value))\n\n    def extend(self, *args, **kwargs):\n        \"\"\"Extends current MutableMultiDict with more values.\n\n        This method must be used instead of update.\n        \"\"\"\n        if len(args) > 1:\n            raise TypeError(\"extend takes at most 2 positional arguments\"\n                            \" ({} given)\".format(len(args) + 1))\n        if args:\n            if isinstance(args[0], MultiDict):\n                items = args[0].items(getall=True)\n            elif hasattr(args[0], 'items'):\n                items = args[0].items()\n            else:\n                items = args[0]\n        else:\n            items = []\n        for key, value in chain(items, kwargs.items()):\n            self.add(key, value)\n\n    def clear(self):\n        \"\"\"Remove all items from MutableMultiDict\"\"\"\n        self._items.clear()\n\n    # MutableMapping interface #\n\n    def __setitem__(self, key, value):\n        try:\n            del self[key]\n        except KeyError:\n            pass\n        self._items.append((key, value))\n\n    def __delitem__(self, key):\n        items = self._items\n        found = False\n        for i in range(len(items)-1, -1, -1):\n            if items[i][0] == key:\n                del items[i]\n                found = True\n        if not found:\n            raise KeyError(key)\n\n    def pop(self, key, default=None):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def popitem(self):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def update(self, *args, **kw):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError(\"Use extend method instead\")\n\n\nclass MutableMultiDict(MutableMultiDictMixin, MultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n\nclass CaseInsensitiveMutableMultiDict(\n        MutableMultiDictMixin, CaseInsensitiveMultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n    def add(self, key, value):\n        super().add(key.upper(), value)\n\n    def __setitem__(self, key, value):\n        super().__setitem__(key.upper(), value)\n\n    def __delitem__(self, key):\n        super().__delitem__(key.upper())\n\n\nclass _ViewBase:\n\n    def __init__(self, items, *, getall=False):\n        self._getall = getall\n        self._keys = [item[0] for item in items]\n        if not getall:\n            self._keys = list(_unique_everseen(self._keys))\n\n        items_to_use = []\n        if getall:\n            items_to_use = items\n        else:\n            for key in self._keys:\n                for k, v in items:\n                    if k == key:\n                        items_to_use.append((k, v))\n                        break\n        assert len(items_to_use) == len(self._keys)\n\n        super().__init__(items_to_use)\n\n\nclass _ItemsView(_ViewBase, abc.ItemsView):\n\n    def __contains__(self, item):\n        assert isinstance(item, tuple) or isinstance(item, list)\n        assert len(item) == 2\n        return item in self._mapping\n\n    def __iter__(self):\n        yield from self._mapping\n\n\nclass _ValuesView(_ViewBase, abc.ValuesView):\n\n    def __contains__(self, value):\n        for item in self._mapping:\n            if item[1] == value:\n                return True\n        return False\n\n    def __iter__(self):\n        for item in self._mapping:\n            yield item[1]\n\n\nclass _KeysView(_ViewBase, abc.KeysView):\n\n    def __contains__(self, key):\n        return key in self._keys\n\n    def __iter__(self):\n        yield from self._keys\n",
            "header": {
                "file": {
                    "path": "aiohttp/multidict.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "d1aef95a",
                "new_commit_hash": "01493936",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/aiohttp/multidict.py"
            },
            "plus_file": {
                "path": "b/aiohttp/multidict.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 86,
                            "length": 7
                        },
                        "new_range": {
                            "start": 86,
                            "length": 7
                        },
                        "section": "class MultiDict(abc.Mapping):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        raise KeyError(key)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __iter__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        return iter(self._items)",
                                "type": "deleted"
                            },
                            {
                                "content": "        return iter(self.keys())",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __len__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        return len(self._items)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "aiohttp/multidict.py",
                            "type": "method",
                            "name": "MultiDict.__iter__",
                            "content": "class MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self._items)\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 88,
                            "end_lineno": 89,
                            "parent": {
                                "file_name": "aiohttp/multidict.py",
                                "type": "class",
                                "name": "MultiDict",
                                "content": "class MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self._items)\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 22,
                                "end_lineno": 120,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "aiohttp/multidict.py",
                            "type": "class",
                            "name": "MultiDict",
                            "content": "class MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self._items)\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 22,
                            "end_lineno": 120,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import unittest\n\nfrom aiohttp.multidict import \\\n    MultiDict, MutableMultiDict, \\\n    CaseInsensitiveMultiDict, CaseInsensitiveMutableMultiDict\n\n\nclass _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])\n\n\nclass MultiDictTests(_BaseTest, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MultiDict(*args, **kwargs)\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MultiDict>\\n[]\")\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n        self.assertEqual(str(d),\n                         \"<MultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_preserve_stable_ordering(self):\n        d = self.make_dict([('a', 1), ('b', '2'), ('a', 3)])\n        s = '&'.join('{}={}'.format(k, v) for k, v in d.items(getall=True))\n\n        self.assertEqual('a=1&b=2&a=3', s)\n\n\nclass CaseInsensitiveMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMultiDict(*args, **kwargs)\n\n    def test_basics(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d.get('key2', 'val'), 'val')\n        self.assertEqual(d['key'], 'value1')\n        self.assertIn('key', d)\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n\nclass _BaseMutableMultiDictTests(_BaseTest):\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MutableMultiDict>\\n[]\")\n\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n\n        self.assertEqual(\n            str(d),\n            \"<MutableMultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_add(self):\n        d = self.make_dict()\n\n        self.assertEqual(d, {})\n        d['key'] = 'one'\n        self.assertEqual(d, {'key': 'one'})\n        self.assertEqual(d.getall('key'), ('one',))\n\n        d['key'] = 'two'\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two',))\n\n        d.add('key', 'one')\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two', 'one'))\n\n        d.add('foo', 'bar')\n        self.assertEqual(d, {'key': 'two', 'foo': 'bar'})\n        self.assertEqual(d.getall('foo'), ('bar',))\n\n    def test_extend(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n\n        d.extend([('key', 'one'), ('key', 'two')], key=3, foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n        itms = d.items(getall=True)\n        # we can't guarantee order of kwargs\n        self.assertTrue(('key', 'one') in itms)\n        self.assertTrue(('key', 'two') in itms)\n        self.assertTrue(('key', 3) in itms)\n        self.assertTrue(('foo', 'bar') in itms)\n\n        other = self.make_dict(bar='baz')\n        self.assertEqual(other, {'bar': 'baz'})\n\n        d.extend(other)\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('bar', 'baz'), d.items(getall=True))\n\n        d.extend({'foo': 'moo'})\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('foo', 'moo'), d.items(getall=True))\n\n        d.extend()\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n\n        with self.assertRaises(TypeError):\n            d.extend('foo', 'bar')\n\n    def test_clear(self):\n        d = self.make_dict([('key', 'one')], key='two', foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        d.clear()\n        self.assertEqual(d, {})\n        self.assertEqual(list(d.items(getall=True)), [])\n\n    def test_del(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two')], foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        del d['key']\n        self.assertEqual(d, {'foo': 'bar'})\n        self.assertEqual(list(d.items(getall=True)), [('foo', 'bar')])\n\n        with self.assertRaises(KeyError):\n            del d['key']\n\n    def test_not_implemented_methods(self):\n        d = self.make_dict()\n\n        with self.assertRaises(NotImplementedError):\n            d.pop('foo')\n        with self.assertRaises(NotImplementedError):\n            d.popitem()\n        with self.assertRaises(NotImplementedError):\n            d.update(bar='baz')\n\n\nclass MutableMultiDictTests(_BaseMutableMultiDictTests, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MutableMultiDict(*args, **kwargs)\n\n\nclass CaseInsensitiveMutableMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMutableMultiDict(*args, **kwargs)\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n    def test_ctor(self):\n        d = self.make_dict(k1='v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_add(self):\n        d = self.make_dict()\n        d.add('k1', 'v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_setitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertEqual('v1', d['K1'])\n\n    def test_delitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertIn('K1', d)\n        del d['k1']\n        self.assertNotIn('K1', d)\n",
            "new_file_content": "import unittest\n\nfrom aiohttp.multidict import \\\n    MultiDict, MutableMultiDict, \\\n    CaseInsensitiveMultiDict, CaseInsensitiveMutableMultiDict\n\n\nclass _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(['key', 'key2'], list(d))\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])\n\n\nclass MultiDictTests(_BaseTest, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MultiDict(*args, **kwargs)\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MultiDict>\\n[]\")\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n        self.assertEqual(str(d),\n                         \"<MultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_preserve_stable_ordering(self):\n        d = self.make_dict([('a', 1), ('b', '2'), ('a', 3)])\n        s = '&'.join('{}={}'.format(k, v) for k, v in d.items(getall=True))\n\n        self.assertEqual('a=1&b=2&a=3', s)\n\n\nclass CaseInsensitiveMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMultiDict(*args, **kwargs)\n\n    def test_basics(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d.get('key2', 'val'), 'val')\n        self.assertEqual(d['key'], 'value1')\n        self.assertIn('key', d)\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n\nclass _BaseMutableMultiDictTests(_BaseTest):\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MutableMultiDict>\\n[]\")\n\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n\n        self.assertEqual(\n            str(d),\n            \"<MutableMultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_add(self):\n        d = self.make_dict()\n\n        self.assertEqual(d, {})\n        d['key'] = 'one'\n        self.assertEqual(d, {'key': 'one'})\n        self.assertEqual(d.getall('key'), ('one',))\n\n        d['key'] = 'two'\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two',))\n\n        d.add('key', 'one')\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two', 'one'))\n\n        d.add('foo', 'bar')\n        self.assertEqual(d, {'key': 'two', 'foo': 'bar'})\n        self.assertEqual(d.getall('foo'), ('bar',))\n\n    def test_extend(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n\n        d.extend([('key', 'one'), ('key', 'two')], key=3, foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n        itms = d.items(getall=True)\n        # we can't guarantee order of kwargs\n        self.assertTrue(('key', 'one') in itms)\n        self.assertTrue(('key', 'two') in itms)\n        self.assertTrue(('key', 3) in itms)\n        self.assertTrue(('foo', 'bar') in itms)\n\n        other = self.make_dict(bar='baz')\n        self.assertEqual(other, {'bar': 'baz'})\n\n        d.extend(other)\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('bar', 'baz'), d.items(getall=True))\n\n        d.extend({'foo': 'moo'})\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('foo', 'moo'), d.items(getall=True))\n\n        d.extend()\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n\n        with self.assertRaises(TypeError):\n            d.extend('foo', 'bar')\n\n    def test_clear(self):\n        d = self.make_dict([('key', 'one')], key='two', foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        d.clear()\n        self.assertEqual(d, {})\n        self.assertEqual(list(d.items(getall=True)), [])\n\n    def test_del(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two')], foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        del d['key']\n        self.assertEqual(d, {'foo': 'bar'})\n        self.assertEqual(list(d.items(getall=True)), [('foo', 'bar')])\n\n        with self.assertRaises(KeyError):\n            del d['key']\n\n    def test_not_implemented_methods(self):\n        d = self.make_dict()\n\n        with self.assertRaises(NotImplementedError):\n            d.pop('foo')\n        with self.assertRaises(NotImplementedError):\n            d.popitem()\n        with self.assertRaises(NotImplementedError):\n            d.update(bar='baz')\n\n\nclass MutableMultiDictTests(_BaseMutableMultiDictTests, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MutableMultiDict(*args, **kwargs)\n\n\nclass CaseInsensitiveMutableMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMutableMultiDict(*args, **kwargs)\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n    def test_ctor(self):\n        d = self.make_dict(k1='v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_add(self):\n        d = self.make_dict()\n        d.add('k1', 'v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_setitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertEqual('v1', d['K1'])\n\n    def test_delitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertIn('K1', d)\n        del d['k1']\n        self.assertNotIn('K1', d)\n",
            "header": {
                "file": {
                    "path": "tests/test_multidict.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "656f9d1c",
                "new_commit_hash": "33b608c9",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/tests/test_multidict.py"
            },
            "plus_file": {
                "path": "b/tests/test_multidict.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 76,
                            "length": 6
                        },
                        "new_range": {
                            "start": 76,
                            "length": 10
                        },
                        "section": "class _BaseTest:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual(d1, d2)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNot(d1, d2)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test__iter__(self):",
                                "type": "added"
                            },
                            {
                                "content": "        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(['key', 'key2'], list(d))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_keys__contains(self):",
                                "type": "context"
                            },
                            {
                                "content": "        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(list(d.keys()), ['key', 'key2'])",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "tests/test_multidict.py",
                            "type": "class",
                            "name": "_BaseTest",
                            "content": "class _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(['key', 'key2'], list(d))\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 8,
                            "end_lineno": 132,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "tests/test_multidict.py",
                            "type": "method",
                            "name": "_BaseTest.test__iter__",
                            "content": "class _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(['key', 'key2'], list(d))\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 79,
                            "end_lineno": 81,
                            "parent": {
                                "file_name": "tests/test_multidict.py",
                                "type": "class",
                                "name": "_BaseTest",
                                "content": "class _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(['key', 'key2'], list(d))\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 8,
                                "end_lineno": 132,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "396e33526ceb241f491d36cdaa72a31c6e0fae92^",
    "new_commit_hash": "396e33526ceb241f491d36cdaa72a31c6e0fae92",
    "commit_message": "Fix multidict.__iter__",
    "commit_date": "2014-11-17T15:02:06+02:00",
    "metadata": {}
}
{
    "repo_name": "aiohttp",
    "new_commit_hash": "396e33526ceb241f491d36cdaa72a31c6e0fae92",
    "test_file_codes": [
        "import unittest\n\nfrom aiohttp.multidict import \\\n    MultiDict, MutableMultiDict, \\\n    CaseInsensitiveMultiDict, CaseInsensitiveMutableMultiDict\n\n\nclass _BaseTest:\n\n    def make_dict(self, *args, **kwargs):\n        raise NotImplementedError\n\n    def test_instantiate__empty(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n        self.assertEqual(len(d), 0)\n        self.assertEqual(list(d.keys()), [])\n        self.assertEqual(list(d.values()), [])\n        self.assertEqual(list(d.values(getall=True)), [])\n        self.assertEqual(list(d.items()), [])\n        self.assertEqual(list(d.items(getall=True)), [])\n\n        self.assertNotEqual(self.make_dict(), list())\n        with self.assertRaisesRegex(TypeError, \"\\(2 given\\)\"):\n            self.make_dict(('key1', 'value1'), ('key2', 'value2'))\n\n    def test_instantiate__from_arg0(self):\n        d = self.make_dict([('key', 'value1')])\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__from_arg0_dict(self):\n        d = self.make_dict({'key': 'value1'})\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 1)\n        self.assertEqual(list(d.keys()), ['key'])\n        self.assertEqual(list(d.values()), ['value1'])\n        self.assertEqual(list(d.values(getall=True)), ['value1'])\n        self.assertEqual(list(d.items()), [('key', 'value1')])\n        self.assertEqual(list(d.items(getall=True)), [('key', 'value1')])\n\n    def test_instantiate__with_kwargs(self):\n        d = self.make_dict([('key', 'value1')], key2='value2')\n\n        self.assertEqual(d, {'key': 'value1', 'key2': 'value2'})\n        self.assertEqual(len(d), 2)\n        self.assertEqual(sorted(d.keys()), ['key', 'key2'])\n        self.assertEqual(sorted(d.values()), ['value1', 'value2'])\n        self.assertEqual(sorted(d.items()), [('key', 'value1'),\n                                             ('key2', 'value2')])\n\n    def test_getone(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d['key'], 'value1')\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n        self.assertEqual('default', d.getone('key2', 'default'))\n\n    def test_copy(self):\n        d1 = self.make_dict(key='value', a='b')\n\n        d2 = d1.copy()\n        self.assertEqual(d1, d2)\n        self.assertIsNot(d1, d2)\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(['key', 'key2'], list(d))\n\n    def test_keys__contains(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n        self.assertEqual(list(d.keys()), ['key', 'key2'])\n        self.assertEqual(list(d.keys(getall=True)), ['key', 'key2', 'key'])\n\n        self.assertIn('key', d.keys())\n        self.assertIn('key2', d.keys())\n\n        self.assertIn('key', d.keys(getall=True))\n        self.assertIn('key2', d.keys(getall=True))\n\n        self.assertNotIn('foo', d.keys())\n        self.assertNotIn('foo', d.keys(getall=True))\n\n    def test_values__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.values()), ['one'])\n        self.assertEqual(list(d.values(getall=True)), ['one', 'two', 3])\n\n        self.assertIn('one', d.values())\n        self.assertNotIn('two', d.values())\n        self.assertNotIn(3, d.values())\n\n        self.assertIn('one', d.values(getall=True))\n        self.assertIn('two', d.values(getall=True))\n        self.assertIn(3, d.values(getall=True))\n\n        self.assertNotIn('foo', d.values())\n        self.assertNotIn('foo', d.values(getall=True))\n\n    def test_items__contains(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two'), ('key', 3)])\n        self.assertEqual(list(d.items()), [('key', 'one')])\n        self.assertEqual(list(d.items(getall=True)),\n                         [('key', 'one'), ('key', 'two'), ('key', 3)])\n\n        self.assertIn(('key', 'one'), d.items())\n        self.assertNotIn(('key', 'two'), d.items())\n        self.assertNotIn(('key', 3), d.items())\n\n        self.assertIn(('key', 'one'), d.items(getall=True))\n        self.assertIn(('key', 'two'), d.items(getall=True))\n        self.assertIn(('key', 3), d.items(getall=True))\n\n        self.assertNotIn(('foo', 'bar'), d.items())\n        self.assertNotIn(('foo', 'bar'), d.items(getall=True))\n\n    def test_cannot_create_from_unaccepted(self):\n        with self.assertRaises(TypeError):\n            self.make_dict([(1, 2, 3)])\n\n\nclass MultiDictTests(_BaseTest, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MultiDict(*args, **kwargs)\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MultiDict>\\n[]\")\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n        self.assertEqual(str(d),\n                         \"<MultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n\n        self.assertEqual(d, {'key': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_preserve_stable_ordering(self):\n        d = self.make_dict([('a', 1), ('b', '2'), ('a', 3)])\n        s = '&'.join('{}={}'.format(k, v) for k, v in d.items(getall=True))\n\n        self.assertEqual('a=1&b=2&a=3', s)\n\n\nclass CaseInsensitiveMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMultiDict(*args, **kwargs)\n\n    def test_basics(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n        self.assertEqual(d.getone('key'), 'value1')\n        self.assertEqual(d.get('key'), 'value1')\n        self.assertEqual(d.get('key2', 'val'), 'val')\n        self.assertEqual(d['key'], 'value1')\n        self.assertIn('key', d)\n\n        with self.assertRaises(KeyError):\n            d['key2']\n        with self.assertRaises(KeyError):\n            d.getone('key2')\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n\nclass _BaseMutableMultiDictTests(_BaseTest):\n\n    def test__repr__(self):\n        d = self.make_dict()\n        self.assertEqual(str(d), \"<MutableMultiDict>\\n[]\")\n\n        d = self.make_dict([('key', 'one'), ('key', 'two')])\n\n        self.assertEqual(\n            str(d),\n            \"<MutableMultiDict>\\n[('key', 'one'), ('key', 'two')]\")\n\n    def test_getall(self):\n        d = self.make_dict([('key', 'value1')], key='value2')\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"some_key\"):\n            d.getall('some_key')\n\n        default = object()\n        self.assertIs(d.getall('some_key', default), default)\n\n    def test_add(self):\n        d = self.make_dict()\n\n        self.assertEqual(d, {})\n        d['key'] = 'one'\n        self.assertEqual(d, {'key': 'one'})\n        self.assertEqual(d.getall('key'), ('one',))\n\n        d['key'] = 'two'\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two',))\n\n        d.add('key', 'one')\n        self.assertEqual(d, {'key': 'two'})\n        self.assertEqual(d.getall('key'), ('two', 'one'))\n\n        d.add('foo', 'bar')\n        self.assertEqual(d, {'key': 'two', 'foo': 'bar'})\n        self.assertEqual(d.getall('foo'), ('bar',))\n\n    def test_extend(self):\n        d = self.make_dict()\n        self.assertEqual(d, {})\n\n        d.extend([('key', 'one'), ('key', 'two')], key=3, foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n        itms = d.items(getall=True)\n        # we can't guarantee order of kwargs\n        self.assertTrue(('key', 'one') in itms)\n        self.assertTrue(('key', 'two') in itms)\n        self.assertTrue(('key', 3) in itms)\n        self.assertTrue(('foo', 'bar') in itms)\n\n        other = self.make_dict(bar='baz')\n        self.assertEqual(other, {'bar': 'baz'})\n\n        d.extend(other)\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('bar', 'baz'), d.items(getall=True))\n\n        d.extend({'foo': 'moo'})\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n        self.assertIn(('foo', 'moo'), d.items(getall=True))\n\n        d.extend()\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar', 'bar': 'baz'})\n\n        with self.assertRaises(TypeError):\n            d.extend('foo', 'bar')\n\n    def test_clear(self):\n        d = self.make_dict([('key', 'one')], key='two', foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        d.clear()\n        self.assertEqual(d, {})\n        self.assertEqual(list(d.items(getall=True)), [])\n\n    def test_del(self):\n        d = self.make_dict([('key', 'one'), ('key', 'two')], foo='bar')\n        self.assertEqual(d, {'key': 'one', 'foo': 'bar'})\n\n        del d['key']\n        self.assertEqual(d, {'foo': 'bar'})\n        self.assertEqual(list(d.items(getall=True)), [('foo', 'bar')])\n\n        with self.assertRaises(KeyError):\n            del d['key']\n\n    def test_not_implemented_methods(self):\n        d = self.make_dict()\n\n        with self.assertRaises(NotImplementedError):\n            d.pop('foo')\n        with self.assertRaises(NotImplementedError):\n            d.popitem()\n        with self.assertRaises(NotImplementedError):\n            d.update(bar='baz')\n\n\nclass MutableMultiDictTests(_BaseMutableMultiDictTests, unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return MutableMultiDict(*args, **kwargs)\n\n\nclass CaseInsensitiveMutableMultiDictTests(unittest.TestCase):\n\n    def make_dict(self, *args, **kwargs):\n        return CaseInsensitiveMutableMultiDict(*args, **kwargs)\n\n    def test_getall(self):\n        d = self.make_dict([('KEY', 'value1')], KEY='value2')\n\n        self.assertEqual(d, {'KEY': 'value1'})\n        self.assertEqual(len(d), 2)\n\n        self.assertEqual(d.getall('key'), ('value1', 'value2'))\n\n        with self.assertRaisesRegex(KeyError, \"SOME_KEY\"):\n            d.getall('some_key')\n\n    def test_ctor(self):\n        d = self.make_dict(k1='v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_add(self):\n        d = self.make_dict()\n        d.add('k1', 'v1')\n        self.assertEqual('v1', d['K1'])\n\n    def test_setitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertEqual('v1', d['K1'])\n\n    def test_delitem(self):\n        d = self.make_dict()\n        d['k1'] = 'v1'\n        self.assertIn('K1', d)\n        del d['k1']\n        self.assertNotIn('K1', d)\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Transforming aiohttp/worker.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 71ms\nInstalled 26 packages in 52ms\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": 0,
    "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_396e33526ceb241f491d36cdaa72a31c6e0fae92\nplugins: asyncio-0.25.0, mock-3.14.0, cov-6.0.0\nasyncio: mode=strict, asyncio_default_fixture_loop_scope=None\ncollected 39 items\n\nr2e_tests/test_1.py .......................................              [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::MultiDictTests::test__iter__\nPASSED r2e_tests/test_1.py::MultiDictTests::test__repr__\nPASSED r2e_tests/test_1.py::MultiDictTests::test_cannot_create_from_unaccepted\nPASSED r2e_tests/test_1.py::MultiDictTests::test_copy\nPASSED r2e_tests/test_1.py::MultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MultiDictTests::test_getone\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__empty\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__from_arg0\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__from_arg0_dict\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__with_kwargs\nPASSED r2e_tests/test_1.py::MultiDictTests::test_items__contains\nPASSED r2e_tests/test_1.py::MultiDictTests::test_keys__contains\nPASSED r2e_tests/test_1.py::MultiDictTests::test_preserve_stable_ordering\nPASSED r2e_tests/test_1.py::MultiDictTests::test_values__contains\nPASSED r2e_tests/test_1.py::CaseInsensitiveMultiDictTests::test_basics\nPASSED r2e_tests/test_1.py::CaseInsensitiveMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test__iter__\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test__repr__\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_add\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_cannot_create_from_unaccepted\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_clear\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_copy\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_del\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_extend\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_getone\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__empty\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__from_arg0\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__from_arg0_dict\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__with_kwargs\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_items__contains\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_keys__contains\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_not_implemented_methods\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_values__contains\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_add\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_ctor\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_delitem\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_setitem\n============================== 39 passed in 0.49s ==============================\n",
    "new_commit_res_stderr": "/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_396e33526ceb241f491d36cdaa72a31c6e0fae92/.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))\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_396e33526ceb241f491d36cdaa72a31c6e0fae92\nplugins: asyncio-0.25.0, mock-3.14.0, cov-6.0.0\nasyncio: mode=strict, asyncio_default_fixture_loop_scope=None\ncollected 39 items\n\nr2e_tests/test_1.py F...............F......................              [100%]\n\n=================================== FAILURES ===================================\n_________________________ MultiDictTests.test__iter__ __________________________\n\nself = <r2e_tests.test_1.MultiDictTests testMethod=test__iter__>\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n>       self.assertEqual(['key', 'key2'], list(d))\nE       AssertionError: Lists differ: ['key', 'key2'] != [('key', 'one'), ('key2', 'two'), ('key', 3)]\nE       \nE       First differing element 0:\nE       'key'\nE       ('key', 'one')\nE       \nE       Second list contains 1 additional elements.\nE       First extra element 2:\nE       ('key', 3)\nE       \nE       - ['key', 'key2']\nE       + [('key', 'one'), ('key2', 'two'), ('key', 3)]\n\nr2e_tests/test_1.py:81: AssertionError\n______________________ MutableMultiDictTests.test__iter__ ______________________\n\nself = <r2e_tests.test_1.MutableMultiDictTests testMethod=test__iter__>\n\n    def test__iter__(self):\n        d = self.make_dict([('key', 'one'), ('key2', 'two'), ('key', 3)])\n>       self.assertEqual(['key', 'key2'], list(d))\nE       AssertionError: Lists differ: ['key', 'key2'] != [('key', 'one'), ('key2', 'two'), ('key', 3)]\nE       \nE       First differing element 0:\nE       'key'\nE       ('key', 'one')\nE       \nE       Second list contains 1 additional elements.\nE       First extra element 2:\nE       ('key', 3)\nE       \nE       - ['key', 'key2']\nE       + [('key', 'one'), ('key2', 'two'), ('key', 3)]\n\nr2e_tests/test_1.py:81: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::MultiDictTests::test__repr__\nPASSED r2e_tests/test_1.py::MultiDictTests::test_cannot_create_from_unaccepted\nPASSED r2e_tests/test_1.py::MultiDictTests::test_copy\nPASSED r2e_tests/test_1.py::MultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MultiDictTests::test_getone\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__empty\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__from_arg0\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__from_arg0_dict\nPASSED r2e_tests/test_1.py::MultiDictTests::test_instantiate__with_kwargs\nPASSED r2e_tests/test_1.py::MultiDictTests::test_items__contains\nPASSED r2e_tests/test_1.py::MultiDictTests::test_keys__contains\nPASSED r2e_tests/test_1.py::MultiDictTests::test_preserve_stable_ordering\nPASSED r2e_tests/test_1.py::MultiDictTests::test_values__contains\nPASSED r2e_tests/test_1.py::CaseInsensitiveMultiDictTests::test_basics\nPASSED r2e_tests/test_1.py::CaseInsensitiveMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test__repr__\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_add\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_cannot_create_from_unaccepted\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_clear\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_copy\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_del\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_extend\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_getone\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__empty\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__from_arg0\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__from_arg0_dict\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_instantiate__with_kwargs\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_items__contains\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_keys__contains\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_not_implemented_methods\nPASSED r2e_tests/test_1.py::MutableMultiDictTests::test_values__contains\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_add\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_ctor\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_delitem\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_getall\nPASSED r2e_tests/test_1.py::CaseInsensitiveMutableMultiDictTests::test_setitem\nFAILED r2e_tests/test_1.py::MultiDictTests::test__iter__ - AssertionError: Li...\nFAILED r2e_tests/test_1.py::MutableMultiDictTests::test__iter__ - AssertionEr...\n========================= 2 failed, 37 passed in 0.20s =========================\n",
    "old_commit_res_stderr": "/home/gcpuser/buckets/local_repoeval_bucket/repos/aiohttp_396e33526ceb241f491d36cdaa72a31c6e0fae92/.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))\n"
}
CHANGES.txt aiohttp/multidict.py tests/test_multidict.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Iterating over MultiDict returns key-value tuples instead of keys

**Description:**
When iterating over a `MultiDict` instance, it unexpectedly yields key-value tuples instead of just the keys. This behavior causes confusion and fails tests that expect only the keys to be iterated over.

**Example Code:**
```python
from aiohttp import MultiDict

d = MultiDict([('key', 'one'), ('key2', 'two'), ('key', 3)])
for item in d:
    print(item)
```

**Expected Behavior:**
The iteration should output only the keys:
```
key
key2
```

**Actual Behavior:**
The iteration outputs key-value tuples:
```
('key', 'one')
('key2', 'two')
('key', 3)
```
[/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/multidict.py
import pprint
from itertools import chain, filterfalse
from collections import abc

_marker = object()


def _unique_everseen(iterable):
    """List unique elements, preserving order.
    Remember all elements ever seen.
    Recipe from
    https://docs.python.org/3/library/itertools.html#itertools-recipes"""
    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
    # unique_everseen('ABBCcAD', str.lower) --> A B C D
    seen = set()
    seen_add = seen.add
    for element in filterfalse(seen.__contains__, iterable):
        seen_add(element)
        yield element


class MultiDict(abc.Mapping):
    """Read-only ordered dictionary that can have multiple values for each key.

    This type of MultiDict must be used for request headers and query args.
    """

    __slots__ = ('_items',)

    def __init__(self, *args, **kwargs):
        if len(args) > 1:
            raise TypeError("MultiDict takes at most 1 positional "
                            "argument ({} given)".format(len(args)))

        self._items = []
        if args:
            if hasattr(args[0], 'items'):
                args = list(args[0].items())
            else:
                args = list(args[0])
                for arg in args:
                    if not len(arg) == 2:
                        raise TypeError("MultiDict takes either dict "
                                        "or list of (key, value) tuples")

        self._fill(chain(args, kwargs.items()))

    def _fill(self, ipairs):
        self._items.extend(ipairs)

    def getall(self, key, default=_marker):
        """
        Return a list of all values matching the key (may be an empty list)
        """
        res = tuple([v for k, v in self._items if k == key])
        if res:
            return res
        if not res and default is not _marker:
            return default
        raise KeyError('Key not found: %r' % key)

    def getone(self, key, default=_marker):
        """
        Get first value matching the key
        """
        for k, v in self._items:
            if k == key:
                return v
        if default is not _marker:
            return default
        raise KeyError('Key not found: %r' % key)

    # extra methods #

    def copy(self):
        """Returns a copy itself."""
        cls = self.__class__
        return cls(self.items(getall=True))

    # Mapping interface #

    def __getitem__(self, key):
        for k, v in self._items:
            if k == key:
                return v
        raise KeyError(key)

    def __iter__(self):
        return iter(self._items)

    def __len__(self):
        return len(self._items)

    def keys(self, *, getall=False):
        return _KeysView(self._items, getall=getall)

    def items(self, *, getall=False):
        return _ItemsView(self._items, getall=getall)

    def values(self, *, getall=False):
        return _ValuesView(self._items, getall=getall)

    def __eq__(self, other):
        if not isinstance(other, abc.Mapping):
            return NotImplemented
        if isinstance(other, MultiDict):
            return self._items == other._items
        return dict(self.items()) == dict(other.items())

    def __contains__(self, key):
        for k, v in self._items:
            if k == key:
                return True
        return False

    def __repr__(self):
        return '<{}>\n{}'.format(
            self.__class__.__name__, pprint.pformat(
                list(self.items(getall=True)))
        )


class CaseInsensitiveMultiDict(MultiDict):
    """Case insensitive multi dict."""

    @classmethod
    def _from_uppercase_multidict(cls, dct):
        # NB: doesn't check for uppercase keys!
        ret = cls.__new__(cls)
        ret._items = dct._items
        return ret

    def _fill(self, ipairs):
        for key, value in ipairs:
            uppkey = key.upper()
            self._items.append((uppkey, value))

    def getall(self, key, default=_marker):
        return super().getall(key.upper(), default)

    def getone(self, key, default=_marker):
        return super().getone(key.upper(), default)

    def __getitem__(self, key):
        return super().__getitem__(key.upper())

    def __contains__(self, key):
        return super().__contains__(key.upper())


class MutableMultiDictMixin(abc.MutableMapping):

    def add(self, key, value):
        """
        Add the key and value, not overwriting any previous value.
        """
        self._items.append((key, value))

    def extend(self, *args, **kwargs):
        """Extends current MutableMultiDict with more values.

        This method must be used instead of update.
        """
        if len(args) > 1:
            raise TypeError("extend takes at most 2 positional arguments"
                            " ({} given)".format(len(args) + 1))
        if args:
            if isinstance(args[0], MultiDict):
                items = args[0].items(getall=True)
            elif hasattr(args[0], 'items'):
                items = args[0].items()
            else:
                items = args[0]
        else:
            items = []
        for key, value in chain(items, kwargs.items()):
            self.add(key, value)

    def clear(self):
        """Remove all items from MutableMultiDict"""
        self._items.clear()

    # MutableMapping interface #

    def __setitem__(self, key, value):
        try:
            del self[key]
        except KeyError:
            pass
        self._items.append((key, value))

    def __delitem__(self, key):
        items = self._items
        found = False
        for i in range(len(items)-1, -1, -1):
            if items[i][0] == key:
                del items[i]
                found = True
        if not found:
            raise KeyError(key)

    def pop(self, key, default=None):
        """Method not allowed."""
        raise NotImplementedError

    def popitem(self):
        """Method not allowed."""
        raise NotImplementedError

    def update(self, *args, **kw):
        """Method not allowed."""
        raise NotImplementedError("Use extend method instead")


class MutableMultiDict(MutableMultiDictMixin, MultiDict):
    """An ordered dictionary that can have multiple values for each key."""


class CaseInsensitiveMutableMultiDict(
        MutableMultiDictMixin, CaseInsensitiveMultiDict):
    """An ordered dictionary that can have multiple values for each key."""

    def add(self, key, value):
        super().add(key.upper(), value)

    def __setitem__(self, key, value):
        super().__setitem__(key.upper(), value)

    def __delitem__(self, key):
        super().__delitem__(key.upper())


class _ViewBase:

    def __init__(self, items, *, getall=False):
        self._getall = getall
        self._keys = [item[0] for item in items]
        if not getall:
            self._keys = list(_unique_everseen(self._keys))

        items_to_use = []
        if getall:
            items_to_use = items
        else:
            for key in self._keys:
                for k, v in items:
                    if k == key:
                        items_to_use.append((k, v))
                        break
        assert len(items_to_use) == len(self._keys)

        super().__init__(items_to_use)


class _ItemsView(_ViewBase, abc.ItemsView):

    def __contains__(self, item):
        assert isinstance(item, tuple) or isinstance(item, list)
        assert len(item) == 2
        return item in self._mapping

    def __iter__(self):
        yield from self._mapping


class _ValuesView(_ViewBase, abc.ValuesView):

    def __contains__(self, value):
        for item in self._mapping:
            if item[1] == value:
                return True
        return False

    def __iter__(self):
        for item in self._mapping:
            yield item[1]


class _KeysView(_ViewBase, abc.KeysView):

    def __contains__(self, key):
        return key in self._keys

    def __iter__(self):
        yield from self._keys

```
--- 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]
**Title:** Iterating over MultiDict returns key-value tuples instead of keys

**Description:**
When iterating over a `MultiDict` instance, it unexpectedly yields key-value tuples instead of just the keys. This behavior causes confusion and fails tests that expect only the keys to be iterated over.

**Example Code:**
```python
from aiohttp import MultiDict

d = MultiDict([('key', 'one'), ('key2', 'two'), ('key', 3)])
for item in d:
    print(item)
```

**Expected Behavior:**
The iteration should output only the keys:
```
key
key2
```

**Actual Behavior:**
The iteration outputs key-value tuples:
```
('key', 'one')
('key2', 'two')
('key', 3)
```
[/ISSUE]
{
    "MultiDictTests.test__iter__": "PASSED",
    "MultiDictTests.test__repr__": "PASSED",
    "MultiDictTests.test_cannot_create_from_unaccepted": "PASSED",
    "MultiDictTests.test_copy": "PASSED",
    "MultiDictTests.test_getall": "PASSED",
    "MultiDictTests.test_getone": "PASSED",
    "MultiDictTests.test_instantiate__empty": "PASSED",
    "MultiDictTests.test_instantiate__from_arg0": "PASSED",
    "MultiDictTests.test_instantiate__from_arg0_dict": "PASSED",
    "MultiDictTests.test_instantiate__with_kwargs": "PASSED",
    "MultiDictTests.test_items__contains": "PASSED",
    "MultiDictTests.test_keys__contains": "PASSED",
    "MultiDictTests.test_preserve_stable_ordering": "PASSED",
    "MultiDictTests.test_values__contains": "PASSED",
    "CaseInsensitiveMultiDictTests.test_basics": "PASSED",
    "CaseInsensitiveMultiDictTests.test_getall": "PASSED",
    "MutableMultiDictTests.test__iter__": "PASSED",
    "MutableMultiDictTests.test__repr__": "PASSED",
    "MutableMultiDictTests.test_add": "PASSED",
    "MutableMultiDictTests.test_cannot_create_from_unaccepted": "PASSED",
    "MutableMultiDictTests.test_clear": "PASSED",
    "MutableMultiDictTests.test_copy": "PASSED",
    "MutableMultiDictTests.test_del": "PASSED",
    "MutableMultiDictTests.test_extend": "PASSED",
    "MutableMultiDictTests.test_getall": "PASSED",
    "MutableMultiDictTests.test_getone": "PASSED",
    "MutableMultiDictTests.test_instantiate__empty": "PASSED",
    "MutableMultiDictTests.test_instantiate__from_arg0": "PASSED",
    "MutableMultiDictTests.test_instantiate__from_arg0_dict": "PASSED",
    "MutableMultiDictTests.test_instantiate__with_kwargs": "PASSED",
    "MutableMultiDictTests.test_items__contains": "PASSED",
    "MutableMultiDictTests.test_keys__contains": "PASSED",
    "MutableMultiDictTests.test_not_implemented_methods": "PASSED",
    "MutableMultiDictTests.test_values__contains": "PASSED",
    "CaseInsensitiveMutableMultiDictTests.test_add": "PASSED",
    "CaseInsensitiveMutableMultiDictTests.test_ctor": "PASSED",
    "CaseInsensitiveMutableMultiDictTests.test_delitem": "PASSED",
    "CaseInsensitiveMutableMultiDictTests.test_getall": "PASSED",
    "CaseInsensitiveMutableMultiDictTests.test_setitem": "PASSED"
}
diff --git a/aiohttp/multidict.py b/aiohttp/multidict.py
index d1aef95a..01493936 100644
--- a/aiohttp/multidict.py
+++ b/aiohttp/multidict.py
@@ -86,7 +86,7 @@ class MultiDict(abc.Mapping):
         raise KeyError(key)
 
     def __iter__(self):
-        return iter(self._items)
+        return iter(self.keys())
 
     def __len__(self):
         return len(self._items)

{"aiohttp/multidict.py": "import pprint\nfrom itertools import chain, filterfalse\nfrom collections import abc\n\n_marker = object()\n\n\ndef _unique_everseen(iterable):\n    \"\"\"List unique elements, preserving order.\n    Remember all elements ever seen.\n    Recipe from\n    https://docs.python.org/3/library/itertools.html#itertools-recipes\"\"\"\n    # unique_everseen('AAAABBBCCDAABBB') --> A B C D\n    # unique_everseen('ABBCcAD', str.lower) --> A B C D\n    seen = set()\n    seen_add = seen.add\n    for element in filterfalse(seen.__contains__, iterable):\n        seen_add(element)\n        yield element\n\n\nclass MultiDict(abc.Mapping):\n    \"\"\"Read-only ordered dictionary that can have multiple values for each key.\n\n    This type of MultiDict must be used for request headers and query args.\n    \"\"\"\n\n    __slots__ = ('_items',)\n\n    def __init__(self, *args, **kwargs):\n        if len(args) > 1:\n            raise TypeError(\"MultiDict takes at most 1 positional \"\n                            \"argument ({} given)\".format(len(args)))\n\n        self._items = []\n        if args:\n            if hasattr(args[0], 'items'):\n                args = list(args[0].items())\n            else:\n                args = list(args[0])\n                for arg in args:\n                    if not len(arg) == 2:\n                        raise TypeError(\"MultiDict takes either dict \"\n                                        \"or list of (key, value) tuples\")\n\n        self._fill(chain(args, kwargs.items()))\n\n    def _fill(self, ipairs):\n        self._items.extend(ipairs)\n\n    def getall(self, key, default=_marker):\n        \"\"\"\n        Return a list of all values matching the key (may be an empty list)\n        \"\"\"\n        res = tuple([v for k, v in self._items if k == key])\n        if res:\n            return res\n        if not res and default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    def getone(self, key, default=_marker):\n        \"\"\"\n        Get first value matching the key\n        \"\"\"\n        for k, v in self._items:\n            if k == key:\n                return v\n        if default is not _marker:\n            return default\n        raise KeyError('Key not found: %r' % key)\n\n    # extra methods #\n\n    def copy(self):\n        \"\"\"Returns a copy itself.\"\"\"\n        cls = self.__class__\n        return cls(self.items(getall=True))\n\n    # Mapping interface #\n\n    def __getitem__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return v\n        raise KeyError(key)\n\n    def __iter__(self):\n        return iter(self._items)\n\n    def __len__(self):\n        return len(self._items)\n\n    def keys(self, *, getall=False):\n        return _KeysView(self._items, getall=getall)\n\n    def items(self, *, getall=False):\n        return _ItemsView(self._items, getall=getall)\n\n    def values(self, *, getall=False):\n        return _ValuesView(self._items, getall=getall)\n\n    def __eq__(self, other):\n        if not isinstance(other, abc.Mapping):\n            return NotImplemented\n        if isinstance(other, MultiDict):\n            return self._items == other._items\n        return dict(self.items()) == dict(other.items())\n\n    def __contains__(self, key):\n        for k, v in self._items:\n            if k == key:\n                return True\n        return False\n\n    def __repr__(self):\n        return '<{}>\\n{}'.format(\n            self.__class__.__name__, pprint.pformat(\n                list(self.items(getall=True)))\n        )\n\n\nclass CaseInsensitiveMultiDict(MultiDict):\n    \"\"\"Case insensitive multi dict.\"\"\"\n\n    @classmethod\n    def _from_uppercase_multidict(cls, dct):\n        # NB: doesn't check for uppercase keys!\n        ret = cls.__new__(cls)\n        ret._items = dct._items\n        return ret\n\n    def _fill(self, ipairs):\n        for key, value in ipairs:\n            uppkey = key.upper()\n            self._items.append((uppkey, value))\n\n    def getall(self, key, default=_marker):\n        return super().getall(key.upper(), default)\n\n    def getone(self, key, default=_marker):\n        return super().getone(key.upper(), default)\n\n    def __getitem__(self, key):\n        return super().__getitem__(key.upper())\n\n    def __contains__(self, key):\n        return super().__contains__(key.upper())\n\n\nclass MutableMultiDictMixin(abc.MutableMapping):\n\n    def add(self, key, value):\n        \"\"\"\n        Add the key and value, not overwriting any previous value.\n        \"\"\"\n        self._items.append((key, value))\n\n    def extend(self, *args, **kwargs):\n        \"\"\"Extends current MutableMultiDict with more values.\n\n        This method must be used instead of update.\n        \"\"\"\n        if len(args) > 1:\n            raise TypeError(\"extend takes at most 2 positional arguments\"\n                            \" ({} given)\".format(len(args) + 1))\n        if args:\n            if isinstance(args[0], MultiDict):\n                items = args[0].items(getall=True)\n            elif hasattr(args[0], 'items'):\n                items = args[0].items()\n            else:\n                items = args[0]\n        else:\n            items = []\n        for key, value in chain(items, kwargs.items()):\n            self.add(key, value)\n\n    def clear(self):\n        \"\"\"Remove all items from MutableMultiDict\"\"\"\n        self._items.clear()\n\n    # MutableMapping interface #\n\n    def __setitem__(self, key, value):\n        try:\n            del self[key]\n        except KeyError:\n            pass\n        self._items.append((key, value))\n\n    def __delitem__(self, key):\n        items = self._items\n        found = False\n        for i in range(len(items)-1, -1, -1):\n            if items[i][0] == key:\n                del items[i]\n                found = True\n        if not found:\n            raise KeyError(key)\n\n    def pop(self, key, default=None):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def popitem(self):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError\n\n    def update(self, *args, **kw):\n        \"\"\"Method not allowed.\"\"\"\n        raise NotImplementedError(\"Use extend method instead\")\n\n\nclass MutableMultiDict(MutableMultiDictMixin, MultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n\nclass CaseInsensitiveMutableMultiDict(\n        MutableMultiDictMixin, CaseInsensitiveMultiDict):\n    \"\"\"An ordered dictionary that can have multiple values for each key.\"\"\"\n\n    def add(self, key, value):\n        super().add(key.upper(), value)\n\n    def __setitem__(self, key, value):\n        super().__setitem__(key.upper(), value)\n\n    def __delitem__(self, key):\n        super().__delitem__(key.upper())\n\n\nclass _ViewBase:\n\n    def __init__(self, items, *, getall=False):\n        self._getall = getall\n        self._keys = [item[0] for item in items]\n        if not getall:\n            self._keys = list(_unique_everseen(self._keys))\n\n        items_to_use = []\n        if getall:\n            items_to_use = items\n        else:\n            for key in self._keys:\n                for k, v in items:\n                    if k == key:\n                        items_to_use.append((k, v))\n                        break\n        assert len(items_to_use) == len(self._keys)\n\n        super().__init__(items_to_use)\n\n\nclass _ItemsView(_ViewBase, abc.ItemsView):\n\n    def __contains__(self, item):\n        assert isinstance(item, tuple) or isinstance(item, list)\n        assert len(item) == 2\n        return item in self._mapping\n\n    def __iter__(self):\n        yield from self._mapping\n\n\nclass _ValuesView(_ViewBase, abc.ValuesView):\n\n    def __contains__(self, value):\n        for item in self._mapping:\n            if item[1] == value:\n                return True\n        return False\n\n    def __iter__(self):\n        for item in self._mapping:\n            yield item[1]\n\n\nclass _KeysView(_ViewBase, abc.KeysView):\n\n    def __contains__(self, key):\n        return key in self._keys\n\n    def __iter__(self):\n        yield from self._keys\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]
**Title:** Iterating over MultiDict returns key-value tuples instead of keys

**Description:**
When iterating over a `MultiDict` instance, it unexpectedly yields key-value tuples instead of just the keys. This behavior causes confusion and fails tests that expect only the keys to be iterated over.

**Example Code:**
```python
from aiohttp import MultiDict

d = MultiDict([('key', 'one'), ('key2', 'two'), ('key', 3)])
for item in d:
    print(item)
```

**Expected Behavior:**
The iteration should output only the keys:
```
key
key2
```

**Actual Behavior:**
The iteration outputs key-value tuples:
```
('key', 'one')
('key2', 'two')
('key', 3)
```
[/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/multidict.py
import pprint
from itertools import chain, filterfalse
from collections import abc

_marker = object()


def _unique_everseen(iterable):
    """List unique elements, preserving order.
    Remember all elements ever seen.
    Recipe from
    https://docs.python.org/3/library/itertools.html#itertools-recipes"""
    # unique_everseen('AAAABBBCCDAABBB') --> A B C D
    # unique_everseen('ABBCcAD', str.lower) --> A B C D
    seen = set()
    seen_add = seen.add
    for element in filterfalse(seen.__contains__, iterable):
        seen_add(element)
        yield element


class MultiDict(abc.Mapping):
    """Read-only ordered dictionary that can have multiple values for each key.

    This type of MultiDict must be used for request headers and query args.
    """

    __slots__ = ('_items',)

    def __init__(self, *args, **kwargs):
        if len(args) > 1:
            raise TypeError("MultiDict takes at most 1 positional "
                            "argument ({} given)".format(len(args)))

        self._items = []
        if args:
            if hasattr(args[0], 'items'):
                args = list(args[0].items())
            else:
                args = list(args[0])
                for arg in args:
                    if not len(arg) == 2:
                        raise TypeError("MultiDict takes either dict "
                                        "or list of (key, value) tuples")

        self._fill(chain(args, kwargs.items()))

    def _fill(self, ipairs):
        self._items.extend(ipairs)

    def getall(self, key, default=_marker):
        """
        Return a list of all values matching the key (may be an empty list)
        """
        res = tuple([v for k, v in self._items if k == key])
        if res:
            return res
        if not res and default is not _marker:
            return default
        raise KeyError('Key not found: %r' % key)

    def getone(self, key, default=_marker):
        """
        Get first value matching the key
        """
        for k, v in self._items:
            if k == key:
                return v
        if default is not _marker:
            return default
        raise KeyError('Key not found: %r' % key)

    # extra methods #

    def copy(self):
        """Returns a copy itself."""
        cls = self.__class__
        return cls(self.items(getall=True))

    # Mapping interface #

    def __getitem__(self, key):
        for k, v in self._items:
            if k == key:
                return v
        raise KeyError(key)

    def __iter__(self):
        return iter(self._items)

    def __len__(self):
        return len(self._items)

    def keys(self, *, getall=False):
        return _KeysView(self._items, getall=getall)

    def items(self, *, getall=False):
        return _ItemsView(self._items, getall=getall)

    def values(self, *, getall=False):
        return _ValuesView(self._items, getall=getall)

    def __eq__(self, other):
        if not isinstance(other, abc.Mapping):
            return NotImplemented
        if isinstance(other, MultiDict):
            return self._items == other._items
        return dict(self.items()) == dict(other.items())

    def __contains__(self, key):
        for k, v in self._items:
            if k == key:
                return True
        return False

    def __repr__(self):
        return '<{}>\n{}'.format(
            self.__class__.__name__, pprint.pformat(
                list(self.items(getall=True)))
        )


class CaseInsensitiveMultiDict(MultiDict):
    """Case insensitive multi dict."""

    @classmethod
    def _from_uppercase_multidict(cls, dct):
        # NB: doesn't check for uppercase keys!
        ret = cls.__new__(cls)
        ret._items = dct._items
        return ret

    def _fill(self, ipairs):
        for key, value in ipairs:
            uppkey = key.upper()
            self._items.append((uppkey, value))

    def getall(self, key, default=_marker):
        return super().getall(key.upper(), default)

    def getone(self, key, default=_marker):
        return super().getone(key.upper(), default)

    def __getitem__(self, key):
        return super().__getitem__(key.upper())

    def __contains__(self, key):
        return super().__contains__(key.upper())


class MutableMultiDictMixin(abc.MutableMapping):

    def add(self, key, value):
        """
        Add the key and value, not overwriting any previous value.
        """
        self._items.append((key, value))

    def extend(self, *args, **kwargs):
        """Extends current MutableMultiDict with more values.

        This method must be used instead of update.
        """
        if len(args) > 1:
            raise TypeError("extend takes at most 2 positional arguments"
                            " ({} given)".format(len(args) + 1))
        if args:
            if isinstance(args[0], MultiDict):
                items = args[0].items(getall=True)
            elif hasattr(args[0], 'items'):
                items = args[0].items()
            else:
                items = args[0]
        else:
            items = []
        for key, value in chain(items, kwargs.items()):
            self.add(key, value)

    def clear(self):
        """Remove all items from MutableMultiDict"""
        self._items.clear()

    # MutableMapping interface #

    def __setitem__(self, key, value):
        try:
            del self[key]
        except KeyError:
            pass
        self._items.append((key, value))

    def __delitem__(self, key):
        items = self._items
        found = False
        for i in range(len(items)-1, -1, -1):
            if items[i][0] == key:
                del items[i]
                found = True
        if not found:
            raise KeyError(key)

    def pop(self, key, default=None):
        """Method not allowed."""
        raise NotImplementedError

    def popitem(self):
        """Method not allowed."""
        raise NotImplementedError

    def update(self, *args, **kw):
        """Method not allowed."""
        raise NotImplementedError("Use extend method instead")


class MutableMultiDict(MutableMultiDictMixin, MultiDict):
    """An ordered dictionary that can have multiple values for each key."""


class CaseInsensitiveMutableMultiDict(
        MutableMultiDictMixin, CaseInsensitiveMultiDict):
    """An ordered dictionary that can have multiple values for each key."""

    def add(self, key, value):
        super().add(key.upper(), value)

    def __setitem__(self, key, value):
        super().__setitem__(key.upper(), value)

    def __delitem__(self, key):
        super().__delitem__(key.upper())


class _ViewBase:

    def __init__(self, items, *, getall=False):
        self._getall = getall
        self._keys = [item[0] for item in items]
        if not getall:
            self._keys = list(_unique_everseen(self._keys))

        items_to_use = []
        if getall:
            items_to_use = items
        else:
            for key in self._keys:
                for k, v in items:
                    if k == key:
                        items_to_use.append((k, v))
                        break
        assert len(items_to_use) == len(self._keys)

        super().__init__(items_to_use)


class _ItemsView(_ViewBase, abc.ItemsView):

    def __contains__(self, item):
        assert isinstance(item, tuple) or isinstance(item, list)
        assert len(item) == 2
        return item in self._mapping

    def __iter__(self):
        yield from self._mapping


class _ValuesView(_ViewBase, abc.ValuesView):

    def __contains__(self, value):
        for item in self._mapping:
            if item[1] == value:
                return True
        return False

    def __iter__(self):
        for item in self._mapping:
            yield item[1]


class _KeysView(_ViewBase, abc.KeysView):

    def __contains__(self, key):
        return key in self._keys

    def __iter__(self):
        yield from self._keys

```
--- 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