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

Function test_prevalence_counter

tests/test_prioritization.py:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def test_prevalence_counter():
5 counter = PrevalenceCounter()
6 sql = """SELECT * FROM foo WHERE bar GROUP BY baz;
7 select * from foo;
8 SELECT * FROM foo WHERE bar GROUP
9 BY baz"""
10 counter.update(sql)
11
12 keywords = ["SELECT", "FROM", "GROUP BY"]
13 expected = [3, 3, 2]
14 kw_counts = [counter.keyword_count(x) for x in keywords]
15 assert kw_counts == expected
16 assert counter.keyword_count("NOSUCHKEYWORD") == 0
17
18 names = ["foo", "bar", "baz"]
19 name_counts = [counter.name_count(x) for x in names]
20 assert name_counts == [3, 2, 2]

Callers

nothing calls this directly

Calls 4

updateMethod · 0.95
keyword_countMethod · 0.95
name_countMethod · 0.95
PrevalenceCounterClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…