예제 #1
0
def test_datasource_base_context_manager():
    # Base data source should raise a "need to implement" exception when it
    # enters the context manager (which loads the schema)

    with pytest.raises(NotImplementedError):
        with base.DataSource():
            pass
예제 #2
0
def test_datasource_base_context_manager():
    # Base data source should raise a "need to implement" exception when it
    # enters the context manager (which loads the schema)

    with pytest.raises(Exception) as except_info:
        with base.DataSource():
            pass
    assert '_get_schema' in str(except_info.value)
예제 #3
0
def test_datasource_base_method_exceptions():
    # Unimplemented methods should raise exceptions
    d = base.DataSource()

    for (method_name, args) in [('_get_schema', []), ('_get_partition', [1]),
                                ('_close', [])]:
        method = getattr(d, method_name)
        with pytest.raises(NotImplementedError):
            method(*args)
예제 #4
0
def test_datasource_base_method_exceptions():
    # Unimplemented methods should raise exceptions
    d = base.DataSource()

    for (method_name, args) in [('_get_schema', []),
                                ('_get_partition', [1]),
                                ('_close', [])]:
        method = getattr(d, method_name)
        with pytest.raises(Exception) as except_info:
            method(*args)
        assert method_name in str(except_info.value)
예제 #5
0
def test_name():
    d = base.DataSource()
    assert d.classname == 'intake.source.base.DataSource'
    assert isinstance(hash(d), int)