Refactor: Fix Flake8 E711 87/68387/2
authorThanh Ha <zxiiro@gmail.com>
Fri, 30 Jul 2021 22:36:22 +0000 (18:36 -0400)
committerThanh Ha <zxiiro@gmail.com>
Sat, 31 Jul 2021 03:46:45 +0000 (23:46 -0400)
Comparisons to the singleton objects, like True, False, and None,
should be done with identity, not equality. Use “is” or “is not”

Ref: https://www.flake8rules.com/rules/E711.html
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: I33e80228341b93bdeb6cae1b587b8b19275c589d

tests/test_nexus.py

index 5887eda..4cc840d 100644 (file)
@@ -115,7 +115,7 @@ def test_create_repo_target_regex():
     for url in test_url_3_par:
         a = util.create_repo_target_regex(url[1], url[0])
         a_regex = re.compile(a)
-        assert a_regex.match(url[2]) != None
+        assert a_regex.match(url[2]) is not None
 
     test_url_2_par = [
         ["org.o-ran-sc.org", "/org/o-ran-sc/org/"],
@@ -135,4 +135,4 @@ def test_create_repo_target_regex():
     for url in test_url_2_par:
         a = util.create_repo_target_regex(url[0])
         a_regex = re.compile(a)
-        assert a_regex.match(url[1]) != None
+        assert a_regex.match(url[1]) is not None