File: test_utils.py

package info (click to toggle)
sphinx-panels 0.6.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 944 kB
  • sloc: python: 1,054; xml: 60; makefile: 23; sh: 16
file content (22 lines) | stat: -rw-r--r-- 643 bytes parent folder | download | duplicates (3)
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