summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-01-31 09:12:43 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-01-31 09:20:49 -0500
commit65b5830a4d13d65c3bb314dd4894d565a16ceb9b (patch)
tree12b5c6bdf4bb68145c75d3c2d802adc050c7febb
parent4bad09744d80c6123e77252d5db09a31db25297b (diff)
downloadpython-coveragepy-git-65b5830a4d13d65c3bb314dd4894d565a16ceb9b.tar.gz
style: singleton comparisons should use is
I guess the original line was wrong, but it would have been nice for unittest2pytest to fix it for me: https://github.com/pytest-dev/unittest2pytest/issues/52
-rw-r--r--igor.py2
-rw-r--r--tests/test_api.py6
-rw-r--r--tests/test_arcs.py2
-rw-r--r--tests/test_config.py16
-rw-r--r--tests/test_context.py2
-rw-r--r--tests/test_data.py2
-rw-r--r--tests/test_execfile.py2
-rw-r--r--tests/test_plugins.py2
8 files changed, 17 insertions, 17 deletions
diff --git a/igor.py b/igor.py
index b2dc05cf..d8d2069d 100644
--- a/igor.py
+++ b/igor.py
@@ -157,7 +157,7 @@ def run_tests_with_coverage(tracer, *runner_args):
try:
# Re-import coverage to get it coverage tested! I don't understand all
# the mechanics here, but if I don't carry over the imported modules
- # (in covmods), then things go haywire (os == None, eventually).
+ # (in covmods), then things go haywire (os is None, eventually).
covmods = {}
covdir = os.path.split(coverage.__file__)[0]
# We have to make a list since we'll be deleting in the loop.
diff --git a/tests/test_api.py b/tests/test_api.py
index 95559986..be7cc83e 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -116,7 +116,7 @@ class ApiTest(CoverageTest):
# Measure without the stdlib.
cov1 = coverage.Coverage()
- assert cov1.config.cover_pylib == False
+ assert cov1.config.cover_pylib is False
self.start_import_stop(cov1, "mymain")
# some statements were marked executed in mymain.py
@@ -1108,9 +1108,9 @@ class ImmutableConfigTest(CoverageTest):
self.make_file("simple.py", "a = 1")
cov = coverage.Coverage()
self.start_import_stop(cov, "simple")
- assert cov.get_option("report:show_missing") == False
+ assert cov.get_option("report:show_missing") is False
cov.report(show_missing=True)
- assert cov.get_option("report:show_missing") == False
+ assert cov.get_option("report:show_missing") is False
class RelativePathTest(CoverageTest):
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 79280e2d..c4d34d30 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -94,7 +94,7 @@ class SimpleArcTest(CoverageTest):
if x % 2: return True
return False
a = fn(1)
- assert a == True
+ assert a is True
""",
arcz=".1 14 45 5. .2 2. 23 3.", arcz_missing="23 3.")
diff --git a/tests/test_config.py b/tests/test_config.py
index 0a742f3d..f1df4d72 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -232,7 +232,7 @@ class ConfigTest(CoverageTest):
self.set_environ("OKAY", "yes")
cov = coverage.Coverage()
assert cov.config.data_file == "hello-world.fooey"
- assert cov.config.branch == True
+ assert cov.config.branch is True
assert cov.config.exclude_list == \
["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
@@ -256,7 +256,7 @@ class ConfigTest(CoverageTest):
self.set_environ("THING", "ZZZ")
cov = coverage.Coverage()
assert cov.config.data_file == "hello-world.fooey"
- assert cov.config.branch == True
+ assert cov.config.branch is True
assert cov.config.exclude_list == \
["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"]
@@ -582,8 +582,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
'names': 'Jane/John/Jenny',
}
assert cov.config.get_plugin_options("plugins.another") == {}
- assert cov.config.json_show_contexts == True
- assert cov.config.json_pretty_print == True
+ assert cov.config.json_show_contexts is True
+ assert cov.config.json_pretty_print is True
def test_config_file_settings(self):
self.make_file(".coveragerc", self.LOTSA_SETTINGS.format(section=""))
@@ -629,8 +629,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
""")
cov = coverage.Coverage()
assert cov.config.run_include == ["foo"]
- assert cov.config.run_omit == None
- assert cov.config.branch == False
+ assert cov.config.run_omit is None
+ assert cov.config.branch is False
def test_setupcfg_only_if_not_coveragerc(self):
self.check_other_not_read_if_coveragerc("setup.cfg")
@@ -646,8 +646,8 @@ class ConfigFileTest(UsingModulesMixin, CoverageTest):
branch = true
""")
cov = coverage.Coverage()
- assert cov.config.run_omit == None
- assert cov.config.branch == False
+ assert cov.config.run_omit is None
+ assert cov.config.branch is False
def test_setupcfg_only_if_prefixed(self):
self.check_other_config_need_prefixes("setup.cfg")
diff --git a/tests/test_context.py b/tests/test_context.py
index be478760..418849d5 100644
--- a/tests/test_context.py
+++ b/tests/test_context.py
@@ -285,4 +285,4 @@ class QualnameTest(CoverageTest):
def test_bug_829(self):
# A class with a name like a function shouldn't confuse qualname_from_frame.
class test_something(object): # pylint: disable=unused-variable
- assert get_qualname() == None
+ assert get_qualname() is None
diff --git a/tests/test_data.py b/tests/test_data.py
index d1ed04e1..9eb6ecee 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -416,7 +416,7 @@ class CoverageDataTest(DataTestHelpers, CoverageTest):
# Asking about an unmeasured file shouldn't make it seem measured.
covdata = CoverageData()
self.assert_measured_files(covdata, [])
- assert covdata.arcs("missing.py") == None
+ assert covdata.arcs("missing.py") is None
self.assert_measured_files(covdata, [])
def test_add_to_hash_with_lines(self):
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index b740d2df..c758f711 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -51,7 +51,7 @@ class RunFileTest(CoverageTest):
assert mod_globs['argv1-n'] == ["arg1", "arg2"]
# __builtins__ should have the right values, like open().
- assert mod_globs['__builtins__.has_open'] == True
+ assert mod_globs['__builtins__.has_open'] is True
def test_no_extra_file(self):
# Make sure that running a file doesn't create an extra compiled file.
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 3472522b..e706ef36 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -403,7 +403,7 @@ class GoodFileTracerTest(FileTracerTest):
analysis = cov._analyze("foo_7.html")
assert analysis.statements == {1, 2, 3, 4, 5, 6, 7}
# Plugins don't do branch coverage yet.
- assert analysis.has_arcs() == True
+ assert analysis.has_arcs() is True
assert analysis.arc_possibilities() == []
assert analysis.missing == {1, 2, 3, 6, 7}