Skip to content

Commit

Permalink
Added on schedule and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
canimus committed Oct 1, 2023
1 parent 6f89df1 commit 7418e78
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/unit/polars_dataframe/test_is_on_schedule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import polars as pl
from cuallee import Check
import pytest
from datetime import datetime, timedelta


def test_positive(check: Check):
check.is_on_schedule("id", (9, 17))
df = pl.DataFrame({"id": pl.Series([datetime(2022,1,1,i,1,0) for i in range(9,18)], dtype=pl.Datetime)})
result = check.validate(df).select(pl.col("status")) == "PASS"
assert all(result.to_series().to_list())


def test_negative(check: Check):
check.is_on_schedule("id", (9, 17))
df = pl.DataFrame({"id": pl.Series([datetime(2022,1,1,i,1,0) for i in range(9,21)], dtype=pl.Datetime)})

result = check.validate(df).select(pl.col("status")) == "FAIL"
assert all(result.to_series().to_list())


def test_coverage(check: Check):
check.is_on_schedule("id", (9, 17), pct=7 / 8)
df = pl.DataFrame({"id": pl.Series([datetime(2022,1,1,i,1,0) for i in range(9,19)], dtype=pl.Datetime)})
result = check.validate(df)

result = check.validate(df).select(pl.col("status")) == "PASS"
assert all(result.to_series().to_list())

0 comments on commit 7418e78

Please sign in to comment.