File: test_clitoolbar.py

package info (click to toggle)
mycli 1.64.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 1,244 kB
  • sloc: python: 11,972; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 745 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from prompt_toolkit.shortcuts import PromptSession

from mycli.clitoolbar import create_toolbar_tokens_func
from mycli.main import MyCli


def test_create_toolbar_tokens_func_initial():
    m = MyCli()
    m.prompt_app = PromptSession()
    iteration = 0
    f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)
    result = f()
    assert any("right-arrow accepts full-line suggestion" in token for token in result)


def test_create_toolbar_tokens_func_short():
    m = MyCli()
    m.prompt_app = PromptSession()
    iteration = 1
    f = create_toolbar_tokens_func(m, lambda: iteration == 0, m.toolbar_format)
    result = f()
    assert not any("right-arrow accepts full-line suggestion" in token for token in result)