Skip to content

Commit d678e72

Browse files
committed
fix(cross-project-tests/**.py): fix comparison to None
from PEP8 (https://peps.python.org/pep-0008/#programming-recommendations): > Comparisons to singletons like None should always be done with is or > is not, never the equality operators.
1 parent 8c3a8c2 commit d678e72

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/command/ParseCommand.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def _build_command(
9898

9999
def label_to_line(label_name: str) -> int:
100100
line = labels.get(label_name, None)
101-
if line != None:
101+
if line is not None:
102102
return line
103103
raise format_unresolved_label_err(label_name, raw_text, path.base, lineno)
104104

cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ConditionalController.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
self.finish_on_remove = finish_on_remove
6363

6464
def has_conditions(self):
65-
return self.expression != None
65+
return self.expression is not None
6666

6767
def get_conditional_expression_list(self):
6868
conditional_list = []
@@ -76,7 +76,7 @@ def add_hit(self):
7676
self.current_hit_count += 1
7777

7878
def should_be_removed(self):
79-
if self.max_hit_count == None:
79+
if self.max_hit_count is None:
8080
return False
8181
return self.current_hit_count >= self.max_hit_count
8282

cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/ControllerHelpers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def update_step_watches(step_info, watches, commands):
3939
for watch in towatch:
4040
loc = step_info.current_location
4141
if (
42-
loc.path != None
42+
loc.path is not None
4343
and os.path.exists(loc.path)
4444
and os.path.samefile(watch.path, loc.path)
4545
and have_hit_line(watch, loc)

cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def handle_debugger_tool_options(context, defaults): # noqa
183183
if options.debugger == "lldb":
184184
_warn_meaningless_option(context, "--show-debugger")
185185

186-
if options.source_root_dir != None:
186+
if options.source_root_dir is not None:
187187
if not os.path.isabs(options.source_root_dir):
188188
raise ToolArgumentError(
189189
f'<d>--source-root-dir: expected absolute path, got</> <r>"{options.source_root_dir}"</>'

cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def delete_breakpoints(self, ids):
256256
for bp in self._debugger.Breakpoints:
257257
# We're looking at the user-set breakpoints so there should be no
258258
# Parent.
259-
assert bp.Parent == None
259+
assert bp.Parent is None
260260
this_vsbp = VSBreakpoint(
261261
PurePath(bp.File), bp.FileLine, bp.FileColumn, bp.Condition
262262
)

cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _get_results_path(self, test_name):
150150
"""Returns the path to the test results directory for the test denoted
151151
by test_name.
152152
"""
153-
assert self.context.options.results_directory != None
153+
assert self.context.options.results_directory is not None
154154
return os.path.join(
155155
self.context.options.results_directory,
156156
self._get_results_basename(test_name),

cross-project-tests/lit.cfg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
def get_required_attr(config, attr_name):
5353
attr_value = getattr(config, attr_name, None)
54-
if attr_value == None:
54+
if attr_value is None:
5555
lit_config.fatal(
5656
"No attribute %r in test configuration! You may need to run "
5757
"tests from your build directory or add this attribute "

0 commit comments

Comments
 (0)