def test_complete_exec(magic, patch):
    patch.init(Document)
    patch.many(Document, ['line_to_cursor', 'word_to_cursor'])
    patch.many(CompletionContext, ['_blocks'])
    patch.object(sentry, 'handle_exception')
    cache = magic()
    plugin = magic()
    ex = Exception('e')
    plugin.complete.side_effect = ex
    c = Completion(plugins=[plugin], context_cache=cache)
    doc = Document()
    ws = magic()
    pos = magic()
    result = c.complete(ws, doc, pos)
    assert isinstance(cache.update.call_args[0][0], CompletionContext)
    assert (result == {'isIncomplete': False, 'items': []})
    assert (sentry.handle_exception.call_args == call(ex))
def test_complete_exec(magic, patch):
    patch.init(Document)
    patch.many(Document, ['line_to_cursor', 'word_to_cursor'])
    patch.many(CompletionContext, ['_blocks'])
    patch.object(sentry, 'handle_exception')
    cache = magic()
    plugin = magic()
    ex = Exception('e')
    plugin.complete.side_effect = ex
    c = Completion(plugins=[plugin], context_cache=cache)
    doc = Document()
    ws = magic()
    pos = magic()
    result = c.complete(ws, doc, pos)
    assert isinstance(cache.update.call_args[0][0], CompletionContext)
    assert (result == {'isIncomplete': False, 'items': []})
    assert (sentry.handle_exception.call_args == call(ex))