35 lines
670 B
Python
35 lines
670 B
Python
from magicli import clean_args
|
|
from magicli import parse_function_name
|
|
from magicli import args_set_in_cli
|
|
|
|
|
|
def test_clean_args():
|
|
args = {
|
|
"<name-1>": True,
|
|
"--name-2": False
|
|
}
|
|
assert clean_args(args) == {
|
|
"name_1": True,
|
|
"name_2": False
|
|
}
|
|
|
|
|
|
def test_parse_function_name():
|
|
assert parse_function_name('<name-1>') == 'name_1'
|
|
assert parse_function_name('--name-2') == 'name_2'
|
|
|
|
|
|
def test_args_set_in_cli():
|
|
args = {
|
|
"a": True,
|
|
"b": False,
|
|
"c": None,
|
|
"d": 1,
|
|
"e": "a"
|
|
}
|
|
assert args_set_in_cli(args) == {
|
|
"a": True,
|
|
"d": 1,
|
|
"e": "a"
|
|
}
|