Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90b0bb8
commit 7e90cd3
Showing
4 changed files
with
40 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
from decouple import strtobool | ||
|
||
|
||
def test_true_values(): | ||
true_list = ["y", "yes", "t", "true", "on", "1"] | ||
for item in true_list: | ||
assert strtobool(item) == 1 | ||
|
||
|
||
def test_false_values(): | ||
false_list = ["n", "no", "f", "false", "off", "0"] | ||
for item in false_list: | ||
assert strtobool(item) == 0 | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"test_input,expected", | ||
[ | ||
("Invalid_Value_1", "invalid truth value Invalid_Value_1"), | ||
("1nv4l1d_V4lu3_2", "invalid truth value 1nv4l1d_V4lu3_2"), | ||
("invalid_value_3", "invalid truth value invalid_value_3"), | ||
], | ||
) | ||
def test_eval(test_input, expected): | ||
with pytest.raises(ValueError) as execinfo: | ||
strtobool(test_input) | ||
assert str(execinfo.value) == expected |
This file was deleted.
Oops, something went wrong.