| Total Complexity | 3 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import sys |
||
| 2 | from opinionated_configparser import get_real_option, get_variant, get_score |
||
| 3 | |||
| 4 | |||
| 5 | def test_get_real_option(): |
||
| 6 | assert get_real_option("") == "" |
||
| 7 | assert get_real_option("foo[bar]") == "foo" |
||
| 8 | assert get_real_option("foo[bar_1]") == "foo" |
||
| 9 | |||
| 10 | |||
| 11 | def test_get_variant(): |
||
| 12 | assert get_variant("") is None |
||
| 13 | assert get_variant("foo") is None |
||
| 14 | assert get_variant("foo[") is None |
||
| 15 | assert get_variant("foo[bar") is None |
||
| 16 | assert get_variant("foo[bar]") == "bar" |
||
| 17 | assert get_variant("foo[]") is None |
||
| 18 | assert get_variant("foo[bar_1_2]") == "bar_1_2" |
||
| 19 | |||
| 20 | |||
| 21 | def test_get_score(): |
||
| 22 | assert get_score(None, "generic") > 0 and get_score(None, "generic") < 1 |
||
| 23 | assert get_score("foo", "generic") == 0 |
||
| 24 | assert get_score("foo", "foo") == sys.maxsize |
||
| 25 | assert get_score("foo", "foo_bar") == 1 |
||
| 26 | assert get_score("foo_bar", "bar") == 0 |
||
| 27 | assert get_score("foo_bar", "foo_bar_1_2_3_4") == 2 |
||
| 28 |