File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed
Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change 55from unittest .mock import Mock
66
77import pytest
8- from prompt_toolkit .buffer import Buffer
98from prompt_toolkit .document import Document
109from prompt_toolkit .formatted_text import (
1110 ANSI ,
2322from cmd2 .parsing import Statement
2423
2524
26- class MockSession :
27- """Simulates a prompt_toolkit PromptSession."""
28-
29- def __init__ (self ):
30- # Contains the CLI text and cursor position
31- self .buffer = Buffer ()
32-
33- # Mock the app structure: session -> app -> current_buffer
34- self .app = Mock ()
35- self .app .current_buffer = self .buffer
36-
37-
3825# Mock for cmd2.Cmd
3926class MockCmd :
40- def __init__ (self ):
27+ def __init__ (self ) -> None :
4128 # Return empty completions by default
4229 self .complete = Mock (return_value = cmd2 .Completions ())
4330
@@ -50,14 +37,13 @@ def __init__(self):
5037 self .aliases = {}
5138 self .macros = {}
5239 self .all_commands = []
53- self .session = MockSession ()
5440
55- def get_all_commands (self ):
41+ def get_all_commands (self ) -> list [ str ] :
5642 return self .all_commands
5743
5844
5945@pytest .fixture
60- def mock_cmd_app ():
46+ def mock_cmd_app () -> MockCmd :
6147 return MockCmd ()
6248
6349
You can’t perform that action at this time.
0 commit comments