Implemented some enhancement requests

This commit is contained in:
2020-12-14 10:30:10 +01:00
parent 657c7536f7
commit e3c2adb533
46 changed files with 352 additions and 1286 deletions
-43
View File
@@ -38,38 +38,6 @@ class TestSheerkaPromptCompleter(TestUsingMemoryBasedSheerka):
assert as_dict["quit"].display_text == "quit"
assert as_dict["quit"].display_meta_text == "command"
def test_i_can_complete_with_pipeable(self):
sheerka = self.get_sheerka()
document = Document("| ")
completions = SheerkaPromptCompleter(sheerka).get_completions(document, CompleteEvent())
as_dict = {c.display_text: c for c in completions}
assert "first" in as_dict
assert as_dict["first"].text == "first()"
assert as_dict["first"].display_text == "first"
assert as_dict["first"].display_meta_text == "builtin"
assert "filter" in as_dict
assert as_dict["filter"].text == "filter("
assert as_dict["filter"].display_text == "filter"
assert as_dict["filter"].display_meta_text == "builtin"
def test_i_can_complete_with_pipeable_when_starting_to_write(self):
sheerka = self.get_sheerka()
document = Document("| f")
completions = SheerkaPromptCompleter(sheerka).get_completions(document, CompleteEvent())
as_dict = {c.display_text: c for c in completions}
assert "first" in as_dict
assert as_dict["first"].text == "first()"
assert as_dict["first"].display_text == "first"
assert as_dict["first"].display_meta_text == "builtin"
assert "filter" in as_dict
assert as_dict["filter"].text == "filter("
assert as_dict["filter"].display_text == "filter"
assert as_dict["filter"].display_meta_text == "builtin"
@pytest.mark.parametrize("text, expected", [
("func(", ["10", "20", "30"]),
("func(1", ["10"]),
@@ -95,17 +63,6 @@ class TestSheerkaPromptCompleter(TestUsingMemoryBasedSheerka):
as_list = [c.display_text for c in completions]
assert as_list == expected
@pytest.mark.parametrize("text, pos, expected", [
("", 0, False),
("foo", 3, False),
("|", 1, True),
("xxx | foo", 9, True),
("xxx | foo", 5, True),
("xxx | foo", 4, False),
])
def test_after_pipe(self, text, pos, expected):
assert SheerkaPromptCompleter.after_pipe(text, pos) == expected
@pytest.mark.parametrize("text, pos, expected", [
("", 0, ""),
("foo", 3, "foo"),