From 7519f742923a31599c56dfc5db9aad6901bfce73 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 5 Feb 2020 11:38:06 -0500 Subject: Added remove_settable() since cmd2 has add_settable() Documented Settable.onchange_cb --- tests/test_cmd2.py | 6 +++++- tests/test_utils.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') 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): -- cgit v1.2.1