fix(dwh): align adapter sampling contract
This commit is contained in:
@@ -6,7 +6,7 @@ import pytest
|
||||
|
||||
from tht.config import LshConfig
|
||||
from tht.db.introspect import introspect
|
||||
from tht.db.sampling import is_text_type, unique_values_for_lsh
|
||||
from tht.db.sampling import distinct_values, is_text_type, sample_column, unique_values_for_lsh
|
||||
|
||||
pytestmark = [pytest.mark.l0]
|
||||
|
||||
@@ -52,3 +52,16 @@ def test_unique_values_for_lsh_truncation_reported(admin_engine):
|
||||
truncated_cols = {(t.table, t.column) for t in truncated}
|
||||
# fct_ricoveri has several eligible text columns with distinct values
|
||||
assert any(t[0] == "fct_ricoveri" for t in truncated_cols)
|
||||
|
||||
|
||||
def test_adapter_sampling_is_distinct_and_frequency_ranked(admin_engine):
|
||||
values = sample_column(admin_engine, "dw", "fct_ricoveri", "reparto", limit=2)
|
||||
assert values == ["cardiologia", "pronto soccorso"]
|
||||
|
||||
|
||||
def test_adapter_distinct_values_reports_truncation(admin_engine):
|
||||
result = distinct_values(
|
||||
admin_engine, "dw", "fct_ricoveri", "reparto", max_values=1
|
||||
)
|
||||
assert result.values == ["cardiologia"]
|
||||
assert result.truncated is True
|
||||
|
||||
Reference in New Issue
Block a user