From 6e6220eb36a1df77f45e6affeaa02fd114ed9fd4 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 7 Aug 2019 18:52:50 -0400 Subject: Verifying command names in __init__ --- tests/test_cmd2.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/test_cmd2.py') diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 1ba10f6b..85246c96 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -87,6 +87,10 @@ def test_base_shortcuts(base_app): expected = normalize(SHORTCUTS_TXT) assert out == expected +def test_command_starts_with_shortcut(): + with pytest.raises(ValueError) as excinfo: + app = cmd2.Cmd(shortcuts={'help': 'fake'}) + assert "Invalid command name 'help'" in str(excinfo.value) def test_base_show(base_app): # force editor to be 'vim' so test is repeatable across platforms -- cgit v1.2.1