diff --git a/.github/workflows/regression_suite.yaml b/.github/workflows/regression_suite.yaml index cac35f3..adac89c 100644 --- a/.github/workflows/regression_suite.yaml +++ b/.github/workflows/regression_suite.yaml @@ -31,23 +31,3 @@ jobs: uses: codecov/codecov-action@v1 with: fail_ci_if_error: false - - mypy: - name: Type Checks - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set Up Environment - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Requirements - run: | - python -m pip install --upgrade pip mypy - pip install -r $GITHUB_WORKSPACE/tests/requirements.txt - - - name: Execute Test - run: mypy data_expectations \ No newline at end of file diff --git a/data_expectations/internals/evaluate.py b/data_expectations/internals/evaluate.py index 0a0b46d..1d5f484 100644 --- a/data_expectations/internals/evaluate.py +++ b/data_expectations/internals/evaluate.py @@ -12,6 +12,7 @@ import typing +from data_expectations import ColumnExpectation from data_expectations import Expectations from data_expectations.errors import ExpectationNotMetError from data_expectations.errors import ExpectationNotUnderstoodError @@ -39,9 +40,13 @@ def evaluate_record(expectations: Expectations, record: dict, suppress_errors: b if expectation not in ALL_EXPECTATIONS: raise ExpectationNotUnderstoodError(expectation=expectation) - if not ALL_EXPECTATIONS[expectation]( - row=record, column=expectation_definition.column, **expectation_definition.config - ): + base_config = {"row": record, **expectation_definition.config} + + # Conditionally include the 'column' parameter + if isinstance(expectation_definition, ColumnExpectation): + base_config["column"] = expectation_definition.column + + if not ALL_EXPECTATIONS[expectation](**base_config): if not suppress_errors: raise ExpectationNotMetError(expectation, record) return False # data failed to meet expectation diff --git a/data_expectations/internals/models.py b/data_expectations/internals/models.py index dd908ec..aa60697 100644 --- a/data_expectations/internals/models.py +++ b/data_expectations/internals/models.py @@ -19,7 +19,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def load(cls: Type["Expectation"], serialized: Union[Dict[str, Any], str]) -> "Expectation": if isinstance(serialized, str): - serialized = json.loads(serialized) + serialized = dict(json.loads(serialized)) serialized_copy: dict = deepcopy(serialized) @@ -43,7 +43,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def load(cls: Type["ColumnExpectation"], serialized: Union[Dict[str, Any], str]) -> "ColumnExpectation": if isinstance(serialized, str): - serialized = json.loads(serialized) + serialized = dict(json.loads(serialized)) serialized_copy: dict = deepcopy(serialized)