summaryrefslogtreecommitdiff
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2020-02-06 18:20:50 -0500
committerGitHub <noreply@github.com>2020-02-06 18:20:50 -0500
commitc7ac2e965d025806ce5baddfc718814e3e58d639 (patch)
tree6e046c2445edf62b024a9389dc719865584dc9cf /tests/test_utils.py
parent60a212c1c585f0c4c06ffcfeb9882520af8dbf35 (diff)
parentc4893ea8a132c06bc71b0ddd63801604e6f85177 (diff)
downloadcmd2-git-c7ac2e965d025806ce5baddfc718814e3e58d639.tar.gz
Merge pull request #873 from python-cmd2/set_update
Updated set command to support tab completion of values
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 9dd54ee2..5030ce0e 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -531,3 +531,24 @@ def test_align_right_wide_fill_needs_padding():
width = 6
aligned = cu.align_right(text, fill_char=fill_char, width=width)
assert aligned == fill_char + ' ' + text
+
+
+def test_str_to_bool_true():
+ assert cu.str_to_bool('true')
+ assert cu.str_to_bool('True')
+ assert cu.str_to_bool('TRUE')
+ assert cu.str_to_bool('tRuE')
+
+def test_str_to_bool_false():
+ assert not cu.str_to_bool('false')
+ assert not cu.str_to_bool('False')
+ assert not cu.str_to_bool('FALSE')
+ assert not cu.str_to_bool('fAlSe')
+
+def test_str_to_bool_invalid():
+ with pytest.raises(ValueError):
+ cu.str_to_bool('other')
+
+def test_str_to_bool_bad_input():
+ with pytest.raises(ValueError):
+ cu.str_to_bool(1)