Skip to content
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

Add get_bool_var for parsing boolean inputs #196

Merged
merged 3 commits into from
Mar 7, 2022

Conversation

ilent2
Copy link
Contributor

@ilent2 ilent2 commented Nov 29, 2021

The function prints a warning when something other than true/false is used. This fixes #194.

Copy link
Owner

@EnricoMi EnricoMi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests would be great like test_get_var for get_bool in test_action_script including true, false, True and False.

Same as get_var(), but checks if the value is a valid boolean.
If the value is unset, defaults to false.
"""
val = get_var(name, options).lower()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_var can return None if name does not exist in options, then calling lower fails

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return default
elif val == 'true':
return True
elif val is 'false':
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be == rather than is

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

Unit Test Results (reference)

       54 files  ±0         54 suites  ±0   2m 27s ⏱️ -9s
     262 tests ±0       262 ✔️ ±0      0 💤 ±0  0 ±0 
14 148 runs  ±0  13 716 ✔️ ±0  432 💤 ±0  0 ±0 

Results for commit e27d276. ± Comparison against base commit f57c7ad.

♻️ This comment has been updated with latest results.

@EnricoMi EnricoMi changed the title Added a get_bool function for parsing inputs Add get_bool_var for parsing boolean inputs Mar 7, 2022
@EnricoMi EnricoMi merged commit 9d2144b into EnricoMi:master Mar 7, 2022
@EnricoMi
Copy link
Owner

EnricoMi commented Mar 7, 2022

@ilent2 thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

report_indivudual_runs is a string not a boolean
2 participants