aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_parse_value.py
blob: 2123337e7f50b520986168e4b9faac3ed53dffe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest

from config_file.parsers.parse_value import can_be_parsed_as_bool, parse_value


@pytest.mark.parametrize(
    "test_input,expected",
    [
        ("5", 5),
        ("-5", -5),
        ("-234.5", -234.5),
        ("35.5", 35.5),
        ("TRUE", True),
        ("true", True),
        ("false", False),
        ("blah", "blah"),
        (343, 343),
        (3.2, 3.2),
        (True, True),
    ],
)
def test_parse_value(test_input, expected):
    assert parse_value(test_input) == expected


def test_can_be_parsed_as_bool():
    """
    This is the section not being covered in the parse_value.py
    file from test_parse_value, but I don't think it's reachable
    from using it.
    """
    assert can_be_parsed_as_bool(5) is False