summaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-21 14:41:28 -0400
committerGitHub <noreply@github.com>2018-09-21 14:41:28 -0400
commit02a319fb88dc873b8325d207213c6ef5e27779a6 (patch)
treec544b6f531feef4c983e861ad5ef5d79ce980d01 /tests/conftest.py
parent69b16f1631c0f808964d797d84a943c862284ab5 (diff)
parentdbe485957b421f6fd973b3a493de7b264b363d54 (diff)
downloadcmd2-git-02a319fb88dc873b8325d207213c6ef5e27779a6.tar.gz
Merge branch 'master' into colorize
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index e177496b..aad2d9f7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -6,9 +6,10 @@ Copyright 2016 Federico Ceratto <federico.ceratto@gmail.com>
Released under MIT license, see LICENSE file
"""
import sys
+from typing import Optional
+from unittest import mock
from pytest import fixture
-from unittest import mock
import cmd2
@@ -152,17 +153,17 @@ def base_app():
return c
-def complete_tester(text, line, begidx, endidx, app):
+def complete_tester(text: str, line: str, begidx: int, endidx: int, app) -> Optional[str]:
"""
This is a convenience function to test cmd2.complete() since
in a unit test environment there is no actual console readline
is monitoring. Therefore we use mock to provide readline data
to complete().
- :param text: str - the string prefix we are attempting to match
- :param line: str - the current input line with leading whitespace removed
- :param begidx: int - the beginning index of the prefix text
- :param endidx: int - the ending index of the prefix text
+ :param text: the string prefix we are attempting to match
+ :param line: the current input line with leading whitespace removed
+ :param begidx: the beginning index of the prefix text
+ :param endidx: the ending index of the prefix text
:param app: the cmd2 app that will run completions
:return: The first matched string or None if there are no matches
Matches are stored in app.completion_matches