diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 11:38:06 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-05 11:39:50 -0500 |
commit | 7519f742923a31599c56dfc5db9aad6901bfce73 (patch) | |
tree | 8d99bca4a0effbda93537e58ef3da70a5f281494 /tests | |
parent | 34f00eda97d44922896beac608a9d4a085ae6e0d (diff) | |
download | cmd2-git-7519f742923a31599c56dfc5db9aad6901bfce73.tar.gz |
Added remove_settable() since cmd2 has add_settable()
Documented Settable.onchange_cb
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_cmd2.py | 6 | ||||
-rw-r--r-- | tests/test_utils.py | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 0615ed46..fecab628 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -630,7 +630,7 @@ now: True def test_debug_not_settable(base_app): # Set debug to False and make it unsettable base_app.debug = False - del base_app.settables['debug'] + base_app.remove_settable('debug') # Cause an exception out, err = run_cmd(base_app, 'bad "quote') @@ -638,6 +638,10 @@ def test_debug_not_settable(base_app): # Since debug is unsettable, the user will not be given the option to enable a full traceback assert err == ['Invalid syntax: No closing quotation'] +def test_remove_settable_keyerror(base_app): + with pytest.raises(KeyError): + base_app.remove_settable('fake') + def test_edit_file(base_app, request, monkeypatch): # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock base_app.editor = 'fooedit' diff --git a/tests/test_utils.py b/tests/test_utils.py index 804e58be..5030ce0e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -537,11 +537,13 @@ 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): |