def test_data_asset_expectation_suite(): asset = DataAsset() default_suite = ExpectationSuite( expectation_suite_name="default", data_asset_type="DataAsset", meta={"great_expectations.__version__": ge_version}, expectations=[]) # We should have a default-initialized suite stored internally and available for getting assert asset._expectation_suite == default_suite assert asset.get_expectation_suite() == default_suite
def test_data_asset_name_inheritance(dataset): # A data_asset should have a generic type data_asset = DataAsset() assert data_asset.get_expectation_suite().data_asset_type == "DataAsset" # A FileDataAsset should pick up its type data_asset = FileDataAsset() assert data_asset.get_expectation_suite().data_asset_type == "FileDataAsset" # So should a Dataset data_asset = Dataset() assert data_asset.get_expectation_suite().data_asset_type == "Dataset" # Backends should *not* change the implementation assert dataset.get_expectation_suite().data_asset_type == "Dataset" # But custom classes should choose to class MyCustomDataset(Dataset): _data_asset_type = "MyCustomDataset" data_asset = MyCustomDataset() assert data_asset.get_expectation_suite().data_asset_type == "MyCustomDataset"
def test_data_asset_expectation_suite(empty_data_context_stats_enabled): context: DataContext = empty_data_context_stats_enabled asset = DataAsset() default_suite = ExpectationSuite( expectation_suite_name="default", data_asset_type="DataAsset", meta={"great_expectations_version": ge_version}, expectations=[], data_context=context, ) # We should have a default-initialized suite stored internally and available for getting assert asset._expectation_suite == default_suite assert asset.get_expectation_suite() == default_suite