summaryrefslogtreecommitdiff
path: root/tests/test_parsing.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_parsing.py')
-rwxr-xr-xtests/test_parsing.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_parsing.py b/tests/test_parsing.py
index c2c242fe..62982ab5 100755
--- a/tests/test_parsing.py
+++ b/tests/test_parsing.py
@@ -836,7 +836,15 @@ def test_statement_is_immutable():
statement.raw = 'baz'
-def test_is_valid_command_invalid(parser):
+def test_is_valid_command_invalid(mocker, parser):
+ # Non-string command
+ valid, errmsg = parser.is_valid_command(5)
+ assert not valid and 'must be a string' in errmsg
+
+ mock = mocker.MagicMock()
+ valid, errmsg = parser.is_valid_command(mock)
+ assert not valid and 'must be a string' in errmsg
+
# Empty command
valid, errmsg = parser.is_valid_command('')
assert not valid and 'cannot be an empty string' in errmsg
@@ -871,6 +879,11 @@ def test_is_valid_command_valid(parser):
assert valid
assert not errmsg
+ # Subcommands can start with shortcut
+ valid, errmsg = parser.is_valid_command('!subcmd', is_subcommand=True)
+ assert valid
+ assert not errmsg
+
def test_macro_normal_arg_pattern():
# This pattern matches digits surrounded by exactly 1 brace on a side and 1 or more braces on the opposite side