Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Batch Expectations correctly handle date min and max values #10613

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bugfix
  • Loading branch information
joshua-stauffer committed Nov 1, 2024
commit 1610b754ea935fae6e88383dd3e57c5dc01f7cb7
10 changes: 10 additions & 0 deletions great_expectations/expectations/expectation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,16 @@
representation.""" # noqa: E501
)

if isinstance(min_value, datetime.date) or isinstance(max_value, datetime.date):
if not isinstance(metric_value, datetime.date):
try:
metric_value = parse(metric_value).date()
except TypeError:
raise ValueError( # noqa: TRY003

Check warning on line 1664 in great_expectations/expectations/expectation.py

View check run for this annotation

Codecov / codecov/patch

great_expectations/expectations/expectation.py#L1663-L1664

Added lines #L1663 - L1664 were not covered by tests
f"""Could not parse "metric_value" of {metric_value} (of type "{type(metric_value)!s}) into datetime \
representation.""" # noqa: E501
)

# Checking if mean lies between thresholds
if min_value is not None:
if strict_min:
Expand Down
Loading