Skip to content

Commit

Permalink
Fix type comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Jan 5, 2024
1 parent 9f36f3a commit 3bb2a68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions click_extra/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ def load_ini_config(self, content):
if target_type in (None, str):
value = ini_config.get(section_id, option_id)

elif target_type == int:
elif target_type is int:
value = ini_config.getint(section_id, option_id)

elif target_type == float:
elif target_type is float:
value = ini_config.getfloat(section_id, option_id)

elif target_type == bool:
elif target_type is bool:
value = ini_config.getboolean(section_id, option_id)

# Types not natively supported by INI format are loaded as
Expand Down
2 changes: 1 addition & 1 deletion click_extra/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def subcommand(int_param):
result = invoke(config_cli3, "--config", str(conf_path), "subcommand", color=False)

assert result.exception
assert type(result.exception) == ValueError
assert type(result.exception) is ValueError
assert (
str(result.exception)
== "Parameter 'random_stuff' is not allowed in configuration file."
Expand Down

0 comments on commit 3bb2a68

Please sign in to comment.