diff options
author | Matthew Peveler <matt.peveler@gmail.com> | 2022-02-17 10:01:42 -0500 |
---|---|---|
committer | Matthew Peveler <matt.peveler@gmail.com> | 2022-02-17 10:01:42 -0500 |
commit | 43d1abfa0f7588ab88377155b0e1b41e67c52502 (patch) | |
tree | 05e5b7e6a9627bd53c380a7f8520abd17b9a845b /tests/test_utils.py | |
parent | 74030cf0edf46110dcef23d307c224727d751f84 (diff) | |
download | asciidoc-py3-43d1abfa0f7588ab88377155b0e1b41e67c52502.tar.gz |
Move some funcs to utils module
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index eb32fbf..7427b52 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -101,3 +101,38 @@ def test_is_array(input, expected): ) def test_py2round(n: float, d: int, expected: float) -> None: assert utils.py2round(n, d) == expected + + +@pytest.mark.parametrize( + "input,expected", + ( + ('"hello","world"', {'1': 'hello', '2': 'world'}), + ('"hello", planet="earth"', {'1': 'hello'}), + ) +) +def test_get_args(input, expected): + assert utils.get_args(input) == expected + + +@pytest.mark.parametrize( + "input,expected", + ( + ('"hello", "world"', {}), + ('planet="earth"', {'planet': 'earth'}), + ('"hello",planet="earth"', {'planet': 'earth'}), + ('planet="earth",foo="bar"', {'planet': 'earth', 'foo': 'bar'}), + ) +) +def test_get_kwargs(input, expected): + assert utils.get_kwargs(input) == expected + + +@pytest.mark.parametrize( + "input,expected", + ( + ('1,2,3', [1, 2, 3]), + ('"a", "b", "c"', ['a', 'b', 'c']) + ) +) +def test_parse_to_list(input, expected): + assert utils.parse_to_list(input) == expected |