Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Upcoming (TBD)
Internal
---------
* Require `sqlglot` 30.x.
* Connect toolbar tests to the test database.


1.65.0 (2026/03/16)
Expand Down
42 changes: 42 additions & 0 deletions test/test_clitoolbar.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,64 @@
# type: ignore

from prompt_toolkit.shortcuts import PromptSession

from mycli.clitoolbar import create_toolbar_tokens_func
from mycli.main import MyCli
from mycli.sqlexecute import SQLExecute
from test.utils import HOST, PASSWORD, PORT, USER, dbtest


@dbtest
def test_create_toolbar_tokens_func_initial():
m = MyCli()
m.sqlexecute = SQLExecute(
None,
USER,
PASSWORD,
HOST,
PORT,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
)
m.prompt_app = PromptSession()
iteration = 0
f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)
result = f()
m.close()
assert any("right-arrow accepts full-line suggestion" in token for token in result)


@dbtest
def test_create_toolbar_tokens_func_short():
m = MyCli()
m.sqlexecute = SQLExecute(
None,
USER,
PASSWORD,
HOST,
PORT,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
)
m.prompt_app = PromptSession()
iteration = 1
f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)
result = f()
m.close()
assert not any("right-arrow accepts full-line suggestion" in token for token in result)
Loading