def test_is_custom_parent_class_recognized_v3_api_yes(): config = { "module_name": "tests.data_context.fixtures.plugins.my_custom_v3_api_datasource", "class_name": "MyCustomV3ApiDatasource", } datasource_anonymizer = DatasourceAnonymizer(salt=CONSISTENT_SALT) parent_class = datasource_anonymizer.is_parent_class_recognized_v3_api( config=config) assert parent_class == "Datasource"
def test_is_parent_class_recognized_v3_api_yes(): v3_batch_request_api_datasources = [ "SimpleSqlalchemyDatasource", "Datasource", "BaseDatasource", ] parent_classes = v3_batch_request_api_datasources configs = [{ "name": "test_datasource", "class_name": parent_class, "module_name": "great_expectations.datasource", } for parent_class in parent_classes] datasource_anonymizer = DatasourceAnonymizer(salt=CONSISTENT_SALT) for idx in range(len(configs)): parent_class = datasource_anonymizer.is_parent_class_recognized_v3_api( config=configs[idx]) assert parent_class == parent_classes[idx]
def test_is_parent_class_recognized_v3_api_no(): v2_batch_kwargs_api_datasources = [ "PandasDatasource", "SqlAlchemyDatasource", "SparkDFDatasource", "LegacyDatasource", ] custom_non_datsource_classes = [ "MyCustomNonDatasourceClass", "MyOtherCustomNonDatasourceClass", ] parent_classes = v2_batch_kwargs_api_datasources + custom_non_datsource_classes configs = [{ "name": "test_datasource", "class_name": parent_class, "module_name": "great_expectations.datasource", } for parent_class in parent_classes] datasource_anonymizer = DatasourceAnonymizer(salt=CONSISTENT_SALT) for idx in range(len(configs)): parent_class = datasource_anonymizer.is_parent_class_recognized_v3_api( config=configs[idx]) assert parent_class != parent_classes[idx] assert parent_class is None