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_bad_argument_param(self):
with raises(ValueError):
arguments(None)
with raises(ValueError):
arguments({})
def test_extract_positional_args(self):
args = arguments(1)
assert args([1], {2: 3}, "blah") == {2: 3}
with raises(TypeError):
assert args()
def test_bad_argument_param(self):
with raises(ValueError):
arguments(None)
with raises(ValueError):
arguments({})
def test_extract_keyword_args(self):
args = arguments("arg")
assert args(arg=1) == 1
with raises(TypeError):
assert args()
def test_args_default_value(self):
args = arguments(2, default={1, 2})
assert args() == {1, 2}
assert args("a", "b", "c") == "c"
def test_kwargs_default_value(self):
args = arguments("key", default="value")
assert args() == "value"
assert args("a", "b", key="blah") == "blah"
def test_postprocess(self):
args = arguments(2, postprocess=lambda x: 1, default={1, 2})
assert args() == {1, 2}
assert args("a", "b", "c") == 1