From 0715ae79f9cbbc9cec6211be35df81d023b723c8 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 4 Jan 2019 18:04:27 +0200 Subject: [PATCH] Fix #3480: Remove deprecation warning (#3481) --- CHANGES/3480.bugfix | 1 + aiohttp/web_response.py | 4 ++-- tests/test_web_response.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 CHANGES/3480.bugfix diff --git a/CHANGES/3480.bugfix b/CHANGES/3480.bugfix new file mode 100644 index 00000000000..eea52e84135 --- /dev/null +++ b/CHANGES/3480.bugfix @@ -0,0 +1 @@ +Replace ``collections.MutableMapping`` with ``collections.abc.MutableMapping`` to avoid a deprecation warning. diff --git a/aiohttp/web_response.py b/aiohttp/web_response.py index ba90d937243..750e040afbc 100644 --- a/aiohttp/web_response.py +++ b/aiohttp/web_response.py @@ -1,5 +1,5 @@ import asyncio # noqa -import collections # noqa +import collections.abc # noqa import datetime import enum import json @@ -39,7 +39,7 @@ from .web_request import BaseRequest # noqa BaseClass = MutableMapping[str, Any] else: - BaseClass = collections.MutableMapping + BaseClass = collections.abc.MutableMapping class ContentCoding(enum.Enum): diff --git a/tests/test_web_response.py b/tests/test_web_response.py index 42ccfe71dbb..70eb35b769d 100644 --- a/tests/test_web_response.py +++ b/tests/test_web_response.py @@ -1,4 +1,4 @@ -import collections +import collections.abc import datetime import gzip import json @@ -94,7 +94,7 @@ def test_stream_response_eq() -> None: def test_stream_response_is_mutable_mapping() -> None: resp = StreamResponse() - assert isinstance(resp, collections.MutableMapping) + assert isinstance(resp, collections.abc.MutableMapping) resp['key'] = 'value' assert 'value' == resp['key']