Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_option_requires():
some_option = 'something'
unset_option = None
set_option = '와 짠이다'
option_requires(
option='--some-option',
requires_all=['--set_option'],
scope=locals()
)
option_requires(
option='--some-option',
requires_any=[
'--set_option',
'--unset-option'],
scope=locals()
)
with pytest.raises(UsageError):
option_requires(
option='--some-option',
requires_all=[
'--set-option',
'--unset-option'],
scope=locals()
)
option_requires(
option='--some-option',
requires_all=['--set_option'],
scope=locals()
)
option_requires(
option='--some-option',
requires_any=[
'--set_option',
'--unset-option'],
scope=locals()
)
with pytest.raises(UsageError):
option_requires(
option='--some-option',
requires_all=[
'--set-option',
'--unset-option'],
scope=locals()
)
with pytest.raises(UsageError):
option_requires(
option='--some-option',
requires_any=[
'--unset-option'],
scope=locals()
)
'--unset-option'],
scope=locals()
)
some_option = ''
option_requires(
option='--some-option',
conditional_value='',
requires_any=[
'--unset-option'],
scope=locals()
)
with pytest.raises(UsageError):
some_option = 'magic'
option_requires(
option='--some-option',
conditional_value='magic',
requires_any=[
'--unset-option'],
scope=locals()
)