MCPcopy Index your code
hub / github.com/dbcli/pgcli / test_ranking_ignores_identifier_quotes

Function test_ranking_ignores_identifier_quotes

tests/test_fuzzy_completion.py:11–28  ·  view source on GitHub ↗

When calculating result rank, identifier quotes should be ignored. The result ranking algorithm ignores identifier quotes. Without this correction, the match "user", which Postgres requires to be quoted since it is also a reserved word, would incorrectly fall below the match user_ac

(completer)

Source from the content-addressed store, hash-verified

9
10
11def test_ranking_ignores_identifier_quotes(completer):
12 """When calculating result rank, identifier quotes should be ignored.
13
14 The result ranking algorithm ignores identifier quotes. Without this
15 correction, the match "user", which Postgres requires to be quoted
16 since it is also a reserved word, would incorrectly fall below the
17 match user_action because the literal quotation marks in "user"
18 alter the position of the match.
19
20 This test checks that the fuzzy ranking algorithm correctly ignores
21 quotation marks when computing match ranks.
22
23 """
24
25 text = "user"
26 collection = ["user_action", '"user"']
27 matches = completer.find_matches(text, collection)
28 assert len(matches) == 2
29
30
31def test_ranking_based_on_shortest_match(completer):

Callers

nothing calls this directly

Calls 1

find_matchesMethod · 0.80

Tested by

no test coverage detected