Skip to content

Commit 50f339c

Browse files
committed
suggestion_list: improve test coverage
Replicates graphql/graphql-js@e38ebb3
1 parent a91e5f8 commit 50f339c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/pyutils/test_suggesion_list.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ def returns_results_when_input_is_empty():
88
def returns_empty_array_when_there_are_no_options():
99
assert suggestion_list("input", []) == []
1010

11+
def returns_options_with_small_lexical_distance():
12+
assert suggestion_list("greenish", ["green"]) == ["green"]
13+
assert suggestion_list("green", ["greenish"]) == ["greenish"]
14+
15+
def returns_options_with_different_case():
16+
assert suggestion_list("verylongstring", ["VERYLONGSTRING"]) == [
17+
"VERYLONGSTRING"
18+
]
19+
20+
assert suggestion_list("VERYLONGSTRING", ["verylongstring"]) == [
21+
"verylongstring"
22+
]
23+
24+
assert suggestion_list("VERYLONGSTRING", ["VeryLongString"]) == [
25+
"VeryLongString"
26+
]
27+
28+
def returns_options_with_transpositions():
29+
assert suggestion_list("agr", ["arg"]) == ["arg"]
30+
31+
assert suggestion_list("214365879", ["123456789"]) == ["123456789"]
32+
1133
def returns_options_sorted_based_on_lexical_distance():
1234
assert suggestion_list("abc", ["a", "ab", "abc"]) == ["abc", "ab"]
1335

0 commit comments

Comments
 (0)