Skip to content

Commit

Permalink
style: Use instance checks for True or False conditions
Browse files Browse the repository at this point in the history
Checking True or False by value makes no sense, they are not values.
Instead we should check if we have an "instance" of the True or False
objects.
  • Loading branch information
rwalton-arm committed Jul 15, 2021
1 parent 74b1f34 commit 8c99997
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/htrun/host_tests_conn_proxy/conn_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def __send_sync(timeout=None):
pass # Check if target sent something
else:
# Return if state machine in host_test_default has finished to end process
if key == "__host_test_finished" and value == True:
if key == "__host_test_finished" and value is True:
logger.prn_inf(
"received special event '%s' value='%s', finishing" % (key, value)
)
Expand Down Expand Up @@ -351,7 +351,7 @@ def __send_sync(timeout=None):
else:
__notify_conn_lost()
break
elif last_sync == True:
elif last_sync is True:
# SYNC lost connection event : Device not responding, send sync failed
__notify_sync_failed()
break
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_runner/host_test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,9 @@ def execute(self):
# Execute test if flashing was successful or skipped
test_result = self.run_test()

if test_result == True:
if test_result is True:
result = self.RESULT_SUCCESS
elif test_result == False:
elif test_result is False:
result = self.RESULT_FAILURE
elif test_result is None:
result = self.RESULT_ERROR
Expand Down
4 changes: 2 additions & 2 deletions src/htrun/host_tests_runner/target_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ def check_flash_error(target_id, disk, initial_remount_count):
"mount_point" in mbed_target
and mbed_target["mount_point"] is not None
):
if not initial_remount_count is None:
if initial_remount_count is not None:
new_remount_count = get_remount_count(disk)
if (
not new_remount_count is None
new_remount_count is not None
and new_remount_count == initial_remount_count
):
sleep(0.5)
Expand Down

0 comments on commit 8c99997

Please sign in to comment.