Пример #1
0
    def returns_options_sorted_based_on_similarity():
        assert suggestion_list("abc", ["a", "ab", "abc"]) == ["abc", "ab"]

        assert suggestion_list(
            "csutomer", ["store", "customer", "stomer", "some", "more"]
        ) == ["customer", "stomer", "store", "some"]

        assert suggestion_list(
            "GraphQl", ["graphics", "SQL", "GraphQL", "quarks", "mark"]
        ) == ["GraphQL", "graphics"]
Пример #2
0
    def returns_options_sorted_based_on_similarity():
        assert suggestion_list('abc', ['a', 'ab', 'abc']) == ['abc', 'ab']

        assert suggestion_list('csutomer',
                               ['store', 'customer', 'stomer', 'some', 'more'
                                ]) == ['customer', 'stomer', 'store', 'some']

        assert suggestion_list(
            'GraphQl', ['graphics', 'SQL', 'GraphQL', 'quarks', 'mark']) == [
                'GraphQL', 'graphics'
            ]
Пример #3
0
def expect_suggestions(input: str, options: List[str],
                       expected: List[str]) -> None:
    assert suggestion_list(input, options) == expected
Пример #4
0
 def returns_empty_array_when_there_are_no_options():
     assert suggestion_list("input", []) == []
Пример #5
0
 def returns_results_when_input_is_empty():
     assert suggestion_list("", ["a"]) == ["a"]
Пример #6
0
 def returns_results_when_input_is_empty():
     assert suggestion_list('', ['a']) == ['a']