1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
import pytest
from sphinx_panels import utils
@pytest.mark.parametrize(
"string,expected",
[
("", ([], {})),
("a", (["a"], {})),
("a,b", (["a", "b"], {})),
("a,1", (["a", 1], {})),
("1,a", ([1, "a"], {})),
("a,b=1", (["a"], {"b": 1})),
('a,b="1"', (["a"], {"b": "1"})),
('a , b = "1,2" ', (["a"], {"b": "1,2"})),
('a , b = "1,2", sdf=4 ', (["a"], {"b": "1,2", "sdf": 4})),
('a,b="""', (["a"], {"b": '"""'})), # This is kind of wrong
],
)
def test_string_to_func_inputs(string, expected):
assert utils.string_to_func_inputs(string) == expected
|