We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91f0ddc commit acd1d53Copy full SHA for acd1d53
1 file changed
tests/test_pt_utils.py
@@ -174,6 +174,19 @@ def test_lex_document_no_command(self, mock_cmd_app):
174
175
assert tokens == [('', ' ')]
176
177
+ def test_lex_document_no_match(self, mock_cmd_app):
178
+ """Test lexing when command pattern fails to match."""
179
+ # Force the pattern to not match anything
180
+ mock_cmd_app.statement_parser._command_pattern = re.compile(r'something_impossible')
181
+ lexer = pt_utils.Cmd2Lexer(cast(Any, mock_cmd_app))
182
+
183
+ line = "test command"
184
+ document = Document(line)
185
+ get_line = lexer.lex_document(document)
186
+ tokens = get_line(0)
187
188
+ assert tokens == [('', line)]
189
190
def test_lex_document_arguments(self, mock_cmd_app):
191
"""Test lexing a command with flags and values."""
192
mock_cmd_app.all_commands = ["help"]
0 commit comments