Skip to content

Commit 3eb6129

Browse files
authored
Merge pull request #544 from powerapi-ng/refactor/type-comparison
refactor: Use `is` instead of `==` to compare types
2 parents 0bdf590 + f5ce9dd commit 3eb6129

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ ignore = [
3030
"B011", # assert-false
3131
"B017", # assert-raises-exception
3232
"B905", # zip-without-explicit-strict
33-
"E721", # type-comparison
3433
"PT001", # pytest-fixture-incorrect-parentheses-style
3534
"PT011", # pytest-raises-too-broad
3635
"PT012", # pytest-raises-with-multiple-statements

tests/unit/cli/test_parsing_manager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def test_parsing_configuration_file_with_unknown_argument_terminate_execution_in
732732
with pytest.raises(SystemExit) as result:
733733
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse(args=f'--config-file {test_files_path}/{config_file}'.split())
734734

735-
assert result.type == SystemExit
735+
assert result.type is SystemExit
736736
assert result.value.code == -1
737737

738738

@@ -746,7 +746,7 @@ def test_parsing_configuration_file_with_wrong_argument_terminate_execution_in_r
746746
with pytest.raises(SystemExit) as result:
747747
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse(args=('--config-file ' + test_files_path + '/' + config_file).split())
748748

749-
assert result.type == SystemExit
749+
assert result.type is SystemExit
750750
assert result.value.code == -1
751751

752752

@@ -807,7 +807,7 @@ def test_parsing_cli_configuration_with_unknown_argument_terminate_execution_in_
807807
with pytest.raises(SystemExit) as result:
808808
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse()
809809

810-
assert result.type == SystemExit
810+
assert result.type is SystemExit
811811
assert result.value.code == -1
812812

813813

@@ -850,7 +850,7 @@ def test_parsing_environment_variables_with_unknown_argument_terminate_execution
850850
with pytest.raises(SystemExit) as result:
851851
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse()
852852

853-
assert result.type == SystemExit
853+
assert result.type is SystemExit
854854
assert result.value.code == -1
855855

856856
remove_environment_variables_configuration(variables_names=created_environment_variables)
@@ -1077,7 +1077,7 @@ def test_parsing_environment_variables_with_subgroups_and_unknown_arguments_term
10771077
with pytest.raises(SystemExit) as result:
10781078
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse()
10791079

1080-
assert result.type == SystemExit
1080+
assert result.type is SystemExit
10811081
assert result.value.code == -1
10821082

10831083
remove_environment_variables_configuration(variables_names=created_environment_variables)
@@ -1126,7 +1126,7 @@ def test_parsing_environment_variables_with_subgroups_and_wrong_type_terminate_e
11261126
with pytest.raises(SystemExit) as result:
11271127
_ = root_config_parsing_manager_with_mandatory_and_optional_arguments.parse()
11281128

1129-
assert result.type == SystemExit
1129+
assert result.type is SystemExit
11301130
assert result.value.code == -1
11311131

11321132
remove_environment_variables_configuration(variables_names=created_environment_variables)
@@ -1287,5 +1287,5 @@ def test_add_repeated_subgroup_terminate_execution_in_root_parsing_manager(root_
12871287
with pytest.raises(SystemExit) as result:
12881288
_ = root_config_parsing_manager.add_subgroup(name='sub')
12891289

1290-
assert result.type == SystemExit
1290+
assert result.type is SystemExit
12911291
assert result.value.code == -1

0 commit comments

Comments
 (0)