diff --git a/tests/tools/bash.py b/tests/tools/bash.py index 26e6c387..743a6981 100644 --- a/tests/tools/bash.py +++ b/tests/tools/bash.py @@ -36,18 +36,18 @@ def runTest(self): ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 3) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 3) is None assert parse_cobertura.hitsPerLine(dom, "shell-main", 4) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 13) == 0 - assert parse_cobertura.hitsPerLine(dom, "shell-main", 26) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 26) is None assert parse_cobertura.hitsPerLine(dom, "shell-main", 30) == 5 - assert parse_cobertura.hitsPerLine(dom, "shell-main", 34) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 38) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 34) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 38) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 5) == 1 assert parse_cobertura.hitsPerLine(dom, "short-test.sh", 5) == 11 assert parse_cobertura.hitsPerLine(dom, "shell-main", 128) == 1 - assert parse_cobertura.hitsPerLine(dom, "shell-main", 132) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 132) is None assert parse_cobertura.hitsPerLine(dom, "shell-main", 135) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 136) == 1 @@ -68,7 +68,7 @@ def runTest(self): ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 3) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 3) is None assert parse_cobertura.hitsPerLine(dom, "shell-main", 4) == 1 assert parse_cobertura.hitsPerLine(dom, "shell-main", 22) == 1 @@ -94,11 +94,11 @@ def runTest(self): dom = self.doTest("5") assert parse_cobertura.hitsPerLine(dom, "shell-main", 52) == 4 - assert parse_cobertura.hitsPerLine(dom, "shell-main", 53) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 55) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 53) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 55) is None assert parse_cobertura.hitsPerLine(dom, "shell-main", 59) == 1 - assert parse_cobertura.hitsPerLine(dom, "shell-main", 61) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 62) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 61) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 62) is None class bash_heredoc_special_cases_issue_44(BashBase): @@ -122,9 +122,9 @@ def runTest(self): class bash_coverage_tricky(BashBase): def runTest(self): dom = self.doTest("5") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 36) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 44) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 7) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 36) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 44) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 7) is None class bash_honor_signal(testbase.KcovTestCase): @@ -372,8 +372,8 @@ def runTest(self): + "/tests/bash/shell-main 5" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 163) == None - assert parse_cobertura.hitsPerLine(dom, "shell-main", 169) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 163) is None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 169) is None # Issue #154 @@ -456,31 +456,31 @@ def runTest(self): + "/tests/bash/other.sh" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/other.sh/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "other.sh", 22) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 22) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 23) == 1 - assert parse_cobertura.hitsPerLine(dom, "other.sh", 26) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 27) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 28) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 26) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 27) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 28) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 29) == 1 - assert parse_cobertura.hitsPerLine(dom, "other.sh", 32) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 34) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 35) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 36) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 32) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 34) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 35) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 36) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 37) == 1 - assert parse_cobertura.hitsPerLine(dom, "other.sh", 40) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 42) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 40) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 42) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 43) == 1 - assert parse_cobertura.hitsPerLine(dom, "other.sh", 47) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 48) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 49) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 47) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 48) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 49) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 51) == 1 # Rust stuff - assert parse_cobertura.hitsPerLine(dom, "other.sh", 54) == None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 54) is None assert parse_cobertura.hitsPerLine(dom, "other.sh", 55) == 1 @@ -538,8 +538,8 @@ def runTest(self): dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/a.sh/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "a.sh", 5) == 1 # Not included in report - assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None - assert parse_cobertura.hitsPerLine(dom, "other.sh", 3) == None + assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) is None + assert parse_cobertura.hitsPerLine(dom, "other.sh", 3) is None class bash_can_ignore_function_with_spaces(testbase.KcovTestCase): @@ -556,10 +556,10 @@ def runTest(self): dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/function-with-spaces.sh/cobertura.xml" ) - assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 5) == None + assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 5) is None assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 6) == 1 - assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 9) == None - assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 10) == None + assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 9) is None + assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 10) is None assert parse_cobertura.hitsPerLine(dom, "function-with-spaces.sh", 11) == 1 diff --git a/tests/tools/compiled.py b/tests/tools/compiled.py index 9022cfc1..b8327ceb 100644 --- a/tests/tools/compiled.py +++ b/tests/tools/compiled.py @@ -587,7 +587,7 @@ def runTest(self): dom = parse_cobertura.parseFile( testbase.outbase + "/kcov/main-tests-debug-file/cobertura.xml" ) - assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == None + assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) is None # Todo: Look in /usr/lib/debug as well diff --git a/tests/tools/compiled_basic.py b/tests/tools/compiled_basic.py index 72ab7643..84b35afb 100644 --- a/tests/tools/compiled_basic.py +++ b/tests/tools/compiled_basic.py @@ -52,7 +52,7 @@ def runTest(self): testbase.outbase + "/kcov/shared_library_test/cobertura.xml" ) assert parse_cobertura.hitsPerLine(dom, "main.c", 9) == 1 - assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == None + assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) is None class shared_library_filter_out(testbase.KcovTestCase): @@ -74,7 +74,7 @@ def runTest(self): testbase.outbase + "/kcov/shared_library_test/cobertura.xml" ) assert parse_cobertura.hitsPerLine(dom, "main.c", 9) == 1 - assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) == None + assert parse_cobertura.hitsPerLine(dom, "solib.c", 5) is None class shared_library_accumulate(testbase.KcovTestCase): @@ -120,7 +120,7 @@ def doTest(self, verify): dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main-tests/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == 1 - assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) == None + assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) is None assert parse_cobertura.hitsPerLine(dom, "main.cc", 18) >= 1 assert parse_cobertura.hitsPerLine(dom, "main.cc", 25) == 1 assert parse_cobertura.hitsPerLine(dom, "file.c", 6) >= 1 diff --git a/tests/tools/filter.py b/tests/tools/filter.py index 7b493e40..aaaa850f 100644 --- a/tests/tools/filter.py +++ b/tests/tools/filter.py @@ -17,7 +17,7 @@ def runTest(self): dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) >= 1 - assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None + assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) is None rv, o = self.do( testbase.kcov @@ -28,7 +28,7 @@ def runTest(self): + "/tests/bash/shell-main" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) is None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) >= 1 rv, o = self.do( @@ -40,8 +40,8 @@ def runTest(self): + "/tests/bash/shell-main" ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None - assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) is None + assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) is None assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) >= 1 @@ -60,7 +60,7 @@ def runTest(self): ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) is None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) >= 1 assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) >= 1 @@ -80,6 +80,6 @@ def runTest(self): ) dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/shell-main/cobertura.xml") - assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) == None + assert parse_cobertura.hitsPerLine(dom, "shell-main", 29) is None assert parse_cobertura.hitsPerLine(dom, "c.sh", 3) >= 1 - assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) == None + assert parse_cobertura.hitsPerLine(dom, "b.sh", 3) is None diff --git a/tests/tools/parse_cobertura.py b/tests/tools/parse_cobertura.py index f2a16cc5..7ac97700 100755 --- a/tests/tools/parse_cobertura.py +++ b/tests/tools/parse_cobertura.py @@ -55,9 +55,9 @@ def hitsPerLine(dom, fileName, lineNr): fileName = fileName.replace(".", "_").replace("-", "_") fileTag = lookupClassName(dom, fileName) - if fileTag != None: + if fileTag is not None: hits = lookupHitsByLine(fileTag, lineNr) - if hits != None: + if hits is not None: return hits return None @@ -76,9 +76,9 @@ def hitsPerLine(dom, fileName, lineNr): dom = parse(data) fileTag = lookupClassName(dom, fileName) - if fileTag != None: + if fileTag is not None: hits = lookupHitsByLine(fileTag, line) - if hits != None: + if hits is not None: print(hits) sys.exit(0) diff --git a/tests/tools/python.py b/tests/tools/python.py index 15d5f317..8cf6e274 100644 --- a/tests/tools/python.py +++ b/tests/tools/python.py @@ -113,19 +113,19 @@ def doTest(self, extra): dom = parse_cobertura.parseFile(testbase.outbase + "/kcov/main/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main", 10) == 2 assert parse_cobertura.hitsPerLine(dom, "main", 17) == 0 - assert parse_cobertura.hitsPerLine(dom, "main", 22) == None + assert parse_cobertura.hitsPerLine(dom, "main", 22) is None assert parse_cobertura.hitsPerLine(dom, "second.py", 2) == 1 - assert parse_cobertura.hitsPerLine(dom, "second.py", 4) == None - assert parse_cobertura.hitsPerLine(dom, "second.py", 11) == None + assert parse_cobertura.hitsPerLine(dom, "second.py", 4) is None + assert parse_cobertura.hitsPerLine(dom, "second.py", 11) is None assert parse_cobertura.hitsPerLine(dom, "second.py", 31) == 0 assert parse_cobertura.hitsPerLine(dom, "second.py", 38) == 1 assert parse_cobertura.hitsPerLine(dom, "second.py", 39) == 0 - assert parse_cobertura.hitsPerLine(dom, "second.py", 40) == None + assert parse_cobertura.hitsPerLine(dom, "second.py", 40) is None assert parse_cobertura.hitsPerLine(dom, "second.py", 41) == 1 - assert parse_cobertura.hitsPerLine(dom, "second.py", 56) == None - assert parse_cobertura.hitsPerLine(dom, "second.py", 60) == None - assert parse_cobertura.hitsPerLine(dom, "second.py", 65) == None - assert parse_cobertura.hitsPerLine(dom, "second.py", 77) == None + assert parse_cobertura.hitsPerLine(dom, "second.py", 56) is None + assert parse_cobertura.hitsPerLine(dom, "second.py", 60) is None + assert parse_cobertura.hitsPerLine(dom, "second.py", 65) is None + assert parse_cobertura.hitsPerLine(dom, "second.py", 77) is None class python_coverage(PythonBase): diff --git a/tests/tools/system_mode.py b/tests/tools/system_mode.py index 0f509a32..8471e269 100644 --- a/tests/tools/system_mode.py +++ b/tests/tools/system_mode.py @@ -26,7 +26,7 @@ def runTest(self): time.sleep(2) - assert os.path.isfile(pf) == False + assert os.path.isfile(pf) is False class system_mode_can_instrument_binary(SystemModeBase): @@ -87,5 +87,5 @@ def runTest(self): dom = parse_cobertura.parseFile(testbase.outbase + "/kcov-report/main-tests/cobertura.xml") assert parse_cobertura.hitsPerLine(dom, "main.cc", 9) == 1 - assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) == None + assert parse_cobertura.hitsPerLine(dom, "main.cc", 14) is None assert parse_cobertura.hitsPerLine(dom, "main.cc", 18) >= 1