pandera icon indicating copy to clipboard operation
pandera copied to clipboard

Set validation scope for pandas run_checks methods

Open amerberg opened this issue 7 months ago • 1 comments

This PR adds decorates two of the pandas run_checks methods with @validate_scope(scope=ValidationScope.DATA).

Currently, these methods have no validation scope set, so, for instance, the following raises a validation error even if we set the environment variable PANDERA_VALIDATION_DEPTH=SCHEMA_ONLY:

import pandas as pd
import pandera as pa

df = pd.DataFrame({"a": [1, 2, 3]})


class Schema(pa.DataFrameModel):
    a: pa.typing.Series[int] = pa.Field(ge=2)


validated_df = Schema.validate(df)

The changes here are consistent with the analogous methods for other backends.

amerberg avatar May 19 '25 17:05 amerberg

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.48%. Comparing base (812b2a8) to head (5d6b8ec). :warning: Report is 358 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2003      +/-   ##
==========================================
- Coverage   94.28%   93.48%   -0.80%     
==========================================
  Files          91      135      +44     
  Lines        7013    10453    +3440     
==========================================
+ Hits         6612     9772    +3160     
- Misses        401      681     +280     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 20 '25 19:05 codecov[bot]

thanks @amerberg ! and congrats on your first contribution to pandera 🚀

cosmicBboy avatar Jul 03 '25 14:07 cosmicBboy