def __init__(self,
              expectation_type,
              kwargs,
              meta=None,
              success_on_last_run=None):
     if not isinstance(expectation_type, str):
         raise InvalidExpectationConfigurationError(
             "expectation_type must be a string")
     self._expectation_type = expectation_type
     if not isinstance(kwargs, dict):
         raise InvalidExpectationConfigurationError(
             "expectation configuration kwargs must be a dict.")
     self._kwargs = kwargs
     self._raw_kwargs = None  # the kwargs before evaluation parameters are evaluated
     if meta is None:
         meta = {}
     # We require meta information to be serializable, but do not convert until necessary
     ensure_json_serializable(meta)
     self.meta = meta
     self.success_on_last_run = success_on_last_run
Пример #2
0
    def __init__(
        self,
        expectation_suite_name,
        data_context=None,
        expectations=None,
        evaluation_parameters=None,
        data_asset_type=None,
        execution_engine_type=None,
        meta=None,
        ge_cloud_id=None,
    ) -> None:
        self.expectation_suite_name = expectation_suite_name
        self.ge_cloud_id = ge_cloud_id
        self._data_context = data_context

        if expectations is None:
            expectations = []
        self.expectations = [
            ExpectationConfiguration(**expectation)
            if isinstance(expectation, dict)
            else expectation
            for expectation in expectations
        ]
        if evaluation_parameters is None:
            evaluation_parameters = {}
        self.evaluation_parameters = evaluation_parameters
        self.data_asset_type = data_asset_type
        self.execution_engine_type = execution_engine_type
        if meta is None:
            meta = {"great_expectations_version": ge_version}
        if (
            "great_expectations.__version__" not in meta.keys()
            and "great_expectations_version" not in meta.keys()
        ):
            meta["great_expectations_version"] = ge_version
        # We require meta information to be serializable, but do not convert until necessary
        ensure_json_serializable(meta)
        self.meta = meta
Пример #3
0
 def __init__(
     self,
     success=None,
     expectation_config=None,
     result=None,
     meta=None,
     exception_info=None,
 ):
     if result and not self.validate_result_dict(result):
         raise InvalidCacheValueError(result)
     self.success = success
     self.expectation_config = expectation_config
     # TODO: re-add
     # assert_json_serializable(result, "result")
     if result is None:
         result = {}
     self.result = result
     if meta is None:
         meta = {}
     # We require meta information to be serializable, but do not convert until necessary
     ensure_json_serializable(meta)
     self.meta = meta
     self.exception_info = exception_info
Пример #4
0
 def __init__(
     self,
     success=None,
     results=None,
     evaluation_parameters=None,
     statistics=None,
     meta=None,
 ):
     self.success = success
     if results is None:
         results = []
     self.results = results
     if evaluation_parameters is None:
         evaluation_parameters = {}
     self.evaluation_parameters = evaluation_parameters
     if statistics is None:
         statistics = {}
     self.statistics = statistics
     if meta is None:
         meta = {}
     ensure_json_serializable(
         meta)  # We require meta information to be serializable.
     self.meta = meta
     self._metrics = {}
Пример #5
0
 def _validate_value(self, value):
     # Values must be json serializable since they must be inputs to expectation configurations
     ensure_json_serializable(value)