Skip to content

Commit 91f0ddc

Browse files
committed
Add a Cmd2Lexer test to cover the case when allow_style is NEVER
1 parent 6fbd9cc commit 91f0ddc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_pt_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ def test_pt_filter_style_never() -> None:
9292

9393

9494
class TestCmd2Lexer:
95+
@with_ansi_style(ru.AllowStyle.NEVER)
96+
def test_lex_document_no_style(self, mock_cmd_app):
97+
"""Test lexing when styles are disallowed."""
98+
lexer = pt_utils.Cmd2Lexer(cast(Any, mock_cmd_app))
99+
100+
line = "help something"
101+
document = Document(line)
102+
get_line = lexer.lex_document(document)
103+
tokens = get_line(0)
104+
105+
assert tokens == [('', line)]
106+
95107
def test_lex_document_command(self, mock_cmd_app):
96108
"""Test lexing a command name."""
97109
mock_cmd_app.all_commands = ["help"]

0 commit comments

Comments
 (0)