From f54cd86b653e222d0aad2075a7265e5cfd840be4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 19 Oct 2019 22:36:32 +0200 Subject: [PATCH] Use ==/!= to compare str, bytes, and int literals https://docs.python.org/3/whatsnew/3.8.html#changes-in-python-behavior The compiler now produces a SyntaxWarning when identity checks (is and is not) are used with certain types of literals (e.g. strings, numbers). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (== and !=) instead. --- tests/test_onionshare_web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_onionshare_web.py b/tests/test_onionshare_web.py index b971b31a..43a8929b 100644 --- a/tests/test_onionshare_web.py +++ b/tests/test_onionshare_web.py @@ -71,7 +71,7 @@ def web_obj(common_obj, mode, num_files=0): class TestWeb: def test_share_mode(self, common_obj): web = web_obj(common_obj, "share", 3) - assert web.mode is "share" + assert web.mode == "share" with web.app.test_client() as c: # Load / without auth res = c.get("/") @@ -127,7 +127,7 @@ class TestWeb: def test_receive_mode(self, common_obj): web = web_obj(common_obj, "receive") - assert web.mode is "receive" + assert web.mode == "receive" with web.app.test_client() as c: # Load / without auth