Skip to content

[cross-project-tests] Use "is" instead of "==" to check for None #94016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _build_command(

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
self.finish_on_remove = finish_on_remove

def has_conditions(self):
return self.expression != None
return self.expression is not None

def get_conditional_expression_list(self):
conditional_list = []
Expand All @@ -76,7 +76,7 @@ def add_hit(self):
self.current_hit_count += 1

def should_be_removed(self):
if self.max_hit_count == None:
if self.max_hit_count is None:
return False
return self.current_hit_count >= self.max_hit_count

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update_step_watches(step_info, watches, commands):
for watch in towatch:
loc = step_info.current_location
if (
loc.path != None
loc.path is not None
and os.path.exists(loc.path)
and os.path.samefile(watch.path, loc.path)
and have_hit_line(watch, loc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def handle_debugger_tool_options(context, defaults): # noqa
if options.debugger == "lldb":
_warn_meaningless_option(context, "--show-debugger")

if options.source_root_dir != None:
if options.source_root_dir is not None:
if not os.path.isabs(options.source_root_dir):
raise ToolArgumentError(
f'<d>--source-root-dir: expected absolute path, got</> <r>"{options.source_root_dir}"</>'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def delete_breakpoints(self, ids):
for bp in self._debugger.Breakpoints:
# We're looking at the user-set breakpoints so there should be no
# Parent.
assert bp.Parent == None
assert bp.Parent is None
this_vsbp = VSBreakpoint(
PurePath(bp.File), bp.FileLine, bp.FileColumn, bp.Condition
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _get_results_path(self, test_name):
"""Returns the path to the test results directory for the test denoted
by test_name.
"""
assert self.context.options.results_directory != None
assert self.context.options.results_directory is not None
return os.path.join(
self.context.options.results_directory,
self._get_results_basename(test_name),
Expand Down
2 changes: 1 addition & 1 deletion cross-project-tests/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
if attr_value == None:
if attr_value is None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
Expand Down
Loading