fix(dwh): validate adapter limits strictly

This commit is contained in:
2026-07-11 20:19:05 +02:00
parent 216984aac8
commit f6302b31dd
7 changed files with 84 additions and 19 deletions
+16
View File
@@ -11,6 +11,22 @@ from tht.db.sampling import distinct_values, is_text_type, sample_column, unique
pytestmark = [pytest.mark.l0]
@pytest.mark.parametrize("invalid_limit", [True, 1.5, 0, -1])
def test_direct_sampling_rejects_non_positive_integer_limits(admin_engine, invalid_limit):
with pytest.raises(ValueError, match="positive integer"):
sample_column(
admin_engine, "dw", "fct_ricoveri", "reparto", limit=invalid_limit
)
with pytest.raises(ValueError, match="positive integer"):
distinct_values(
admin_engine,
"dw",
"fct_ricoveri",
"reparto",
max_values=invalid_limit,
)
def test_is_text_type():
assert is_text_type("text")
assert is_text_type("varchar(100)")