fix(dwh): validate adapter limits strictly
This commit is contained in:
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user