Example #1
0
def test_interface(concrete_class):
    """
    Look for unnecessary implemeneted methods/attributes in MetaProduct,
    this helps us keep the API up-to-date if the Product interface changes
    """
    allowed_mapping = {
        'Input': {'_true', '_null_update_metadata'},
        'Link': {'_false'},
        'PythonCallable': {'load', '_interactive_developer'},
        'SQLScript': {'load'},
    }

    allowed = allowed_mapping.get(concrete_class.__name__, {})

    assert_no_extra_attributes_in_class(Task, concrete_class, allowed=allowed)
Example #2
0
def test_interface(concrete_class):
    """
    Check that Source concrete classes do not have any extra methods
    that are not declared in the Source abstract class
    """
    if concrete_class in {PythonCallableSource, NotebookSource}:
        # FIXME: these two have a lot of extra methods
        pytest.xfail()

    allowed_mapping = {}

    allowed = allowed_mapping.get(concrete_class.__name__, {})

    assert_no_extra_attributes_in_class(Source,
                                        concrete_class,
                                        allowed=allowed)
Example #3
0
def test_interface(concrete_class):
    """
    Look for unnecessary implemented methods/attributes in Tasks concrete
    classes, this helps us keep the API up-to-date
    """
    allowed_mapping = {
        'Input': {'_true', '_null_update_metadata'},
        'Link': {'_false'},
        'PythonCallable': {'load', '_interactive_developer'},
        'SQLScript': {'load'},
        'NotebookRunner': {'static_analysis'}
    }

    allowed = allowed_mapping.get(concrete_class.__name__, {})

    assert_no_extra_attributes_in_class(Task, concrete_class, allowed=allowed)
Example #4
0
def test_interface(concrete_class):
    """
    Look for unnecessary implemeneted methods/attributes in MetaProduct,
    this helps us keep the API up-to-date if the Product interface changes
    """
    allowed_mapping = {
        'SQLRelation': {'schema', 'name', 'kind', 'client'},
        'SQLiteRelation': {'schema', 'name', 'kind', 'client'},
        'PostgresRelation': {'schema', 'name', 'kind', 'client'},
        'GenericProduct': {'client', 'name'},
        # these come from collections.abc.Mapping
        'MetaProduct': {'get', 'keys', 'items', 'values'},
    }

    allowed = allowed_mapping.get(concrete_class.__name__, {})

    assert_no_extra_attributes_in_class(Product,
                                        concrete_class,
                                        allowed=allowed)
Example #5
0
def test_interfaces(concrete_class):
    assert_no_extra_attributes_in_class(AbstractMetadata, concrete_class)