Skip to content

Commit 500837f

Browse files
committed
Add several tests
1 parent 792cf62 commit 500837f

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

tests/test_validate.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5057,6 +5057,55 @@ def test_interrogate_sample_n(request, tbl_fixture):
50575057
assert len(nw.from_native(validation.get_data_extracts(i=1, frame=True)).columns) == 4
50585058

50595059

5060+
def test_interrogate_sample_n_limit():
5061+
game_revenue = load_dataset(dataset="game_revenue", tbl_type="polars")
5062+
5063+
validation_default_limit = (
5064+
Validate(game_revenue).col_vals_gt(columns="item_revenue", value=10000).interrogate()
5065+
)
5066+
5067+
assert (
5068+
len(nw.from_native(validation_default_limit.get_data_extracts(i=1, frame=True)).rows())
5069+
== 500
5070+
)
5071+
5072+
validation_set_n_limit = (
5073+
Validate(game_revenue)
5074+
.col_vals_gt(columns="item_revenue", value=10000)
5075+
.interrogate(get_first_n=10)
5076+
)
5077+
5078+
assert (
5079+
len(nw.from_native(validation_set_n_limit.get_data_extracts(i=1, frame=True)).rows()) == 10
5080+
)
5081+
5082+
validation_set_n_no_limit_break = (
5083+
Validate(game_revenue)
5084+
.col_vals_gt(columns="item_revenue", value=10000)
5085+
.interrogate(get_first_n=750)
5086+
)
5087+
5088+
assert (
5089+
len(
5090+
nw.from_native(
5091+
validation_set_n_no_limit_break.get_data_extracts(i=1, frame=True)
5092+
).rows()
5093+
)
5094+
== 500
5095+
)
5096+
5097+
validation_set_n_adj_limit = (
5098+
Validate(game_revenue)
5099+
.col_vals_gt(columns="item_revenue", value=10000)
5100+
.interrogate(get_first_n=750, extract_limit=1000)
5101+
)
5102+
5103+
assert (
5104+
len(nw.from_native(validation_set_n_adj_limit.get_data_extracts(i=1, frame=True)).rows())
5105+
== 750
5106+
)
5107+
5108+
50605109
@pytest.mark.parametrize(
50615110
"tbl_fixture, sample_frac, expected",
50625111
[
@@ -5096,7 +5145,7 @@ def test_interrogate_sample_frac_with_sample_limit(request, tbl_fixture):
50965145
validation = (
50975146
Validate(tbl)
50985147
.col_vals_regex(columns="text", pattern=r"^[a-z]{3}")
5099-
.interrogate(sample_frac=0.8, sample_limit=1)
5148+
.interrogate(sample_frac=0.8, extract_limit=1)
51005149
)
51015150

51025151
# Expect that the extracts table has 2 entries out of 3 failures

0 commit comments

Comments
 (0)