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
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)
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)
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)
def test_name(): d = base.DataSource() assert d.classname == 'intake.source.base.DataSource' assert isinstance(hash(d), int)