23 lines
742 B
Python
23 lines
742 B
Python
import json
|
|
from tht.cli.sql_cmd import promoted_columns_for
|
|
|
|
|
|
def test_promoted_columns_for(tmp_path):
|
|
sid = "sess1"
|
|
sdir = tmp_path / sid
|
|
sdir.mkdir(parents=True)
|
|
(sdir / "schema_linking.json").write_text(json.dumps({
|
|
"question": "q",
|
|
"candidates": [
|
|
{"kind": "table", "name": "dim_patient", "decision": "promoted"},
|
|
{"kind": "column", "name": "dim_patient.cod_paz", "decision": "promoted"},
|
|
{"kind": "column", "name": "dim_patient.nome", "decision": "excluded"},
|
|
],
|
|
"joins": [], "excluded": [],
|
|
}))
|
|
|
|
class Cfg:
|
|
class paths: # noqa: N801
|
|
sessions = tmp_path
|
|
assert promoted_columns_for(Cfg, sid) == {"dim_patient.cod_paz"}
|