-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added last workflow validation (#126)
- Loading branch information
Showing
2 changed files
with
42 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import polars as pl | ||
from cuallee import Check | ||
import pytest | ||
|
||
|
||
def test_positive(check: Check): | ||
check.has_workflow("group", "event", "order", [("x", "y"), ("y", "z"), ("z", None)]) | ||
df = pl.DataFrame( | ||
{"group": list("AAABBB"), "event": list("xyzxyz"), "order": [1, 2, 3, 1, 2, 3]} | ||
) | ||
result = check.validate(df).select(pl.col("status")) == "PASS" | ||
assert all(result.to_series().to_list()) | ||
|
||
|
||
def test_negative(check: Check): | ||
check.has_workflow("group", "event", "order", [("x", "y"), ("y", "z")]) | ||
df = pl.DataFrame( | ||
{"group": list("AAABBB"), "event": list("xyzxyz"), "order": [1, 2, 3, 1, 2, 3]} | ||
) | ||
result = check.validate(df).select(pl.col("status")) == "FAIL" | ||
assert all(result.to_series().to_list()) | ||
|
||
|
||
def test_coverage(check: Check): | ||
check.has_workflow("group", "event", "order", [("x", "y"), ("y", "z")], pct=4 / 6) | ||
df = pl.DataFrame( | ||
{"group": list("AAABBB"), "event": list("xyzxyz"), "order": [1, 2, 3, 1, 2, 3]} | ||
) | ||
result = check.validate(df).select(pl.col("status")) == "PASS" | ||
assert all(result.to_series().to_list()) |