From a40fb59ba4765c1d222eece959526cd59f2ad7c8 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 14 May 2017 15:36:18 +0300 Subject: [PATCH] Fix #1866: Applications comparison is correct now (#1888) --- CHANGES.rst | 2 ++ aiohttp/web.py | 3 +++ tests/test_web_application.py | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 9330a3c7287..9f89a9ee3eb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -43,6 +43,8 @@ Changes - Fix sub-application middlewares resolution order #1853 +- Fix applications comparison #1866 + 2.0.7 (2017-04-12) ------------------ diff --git a/aiohttp/web.py b/aiohttp/web.py index f117fbc4cea..e1f3d115efd 100644 --- a/aiohttp/web.py +++ b/aiohttp/web.py @@ -81,6 +81,9 @@ def __init__(self, *, # MutableMapping API + def __eq__(self, other): + return self is other + def __getitem__(self, key): return self._state[key] diff --git a/tests/test_web_application.py b/tests/test_web_application.py index 5b65ac7e2ad..0276147f999 100644 --- a/tests/test_web_application.py +++ b/tests/test_web_application.py @@ -219,3 +219,11 @@ def test_secure_proxy_ssl_header_init(loop): assert app._secure_proxy_ssl_header is hdr app.make_handler(loop=loop) assert app._secure_proxy_ssl_header is hdr + + +def test_equality(): + app1 = web.Application() + app2 = web.Application() + + assert app1 == app1 + assert app1 != app2