Exemplo n.º 1
0
def test_disable_block_comments(config, workspace):
    document = Document(DOC_URI, workspace, DOC)
    config.plugin_settings = lambda _: {'enable_block_comments': False}
    symbols = pyls_document_symbols(config, workspace, document)
    expected = [('Unnamed cell 1', 1, 17, 225), ('Cell inside a', 8, 12, 225),
                ('Cell', 10, 12, 225), ('Unnamed cell 2', 13, 17, 225),
                ('Empty cell', 18, 19, 225)]
    test_results = []
    for symbol in symbols:
        name = symbol['name']
        location = symbol['location']
        sym_range = location['range']
        start = sym_range['start']['line']
        end = sym_range['end']['line']
        kind = symbol['kind']
        test_results.append((name, start, end, kind))
    assert expected == test_results
Exemplo n.º 2
0
def test_ungroup_cell_symbols(config, workspace):
    document = Document(DOC_URI, workspace, DOC)
    config.plugin_settings = lambda _: {'group_cells': False}
    symbols = pyls_document_symbols(config, workspace, document)
    expected = [('Unnamed cell 1', 1, 1, 225), ('Imports', 2, 2, 224),
                ('Unnamed comment 1', 6, 6, 224), ('Cell inside a', 8, 8, 225),
                ('Cell', 10, 10, 225), ('Unnamed cell 2', 13, 13, 225),
                ('Pass inside b', 15, 15, 224), ('Empty cell', 18, 18, 225),
                ('Unnamed comment 2', 19, 19, 224)]
    test_results = []
    for symbol in symbols:
        name = symbol['name']
        location = symbol['location']
        sym_range = location['range']
        start = sym_range['start']['line']
        end = sym_range['end']['line']
        kind = symbol['kind']
        test_results.append((name, start, end, kind))
    assert expected == test_results
Exemplo n.º 3
0
def test_cell_block_symbols(config, workspace):
    document = Document(DOC_URI, workspace, DOC)
    symbols = pyls_document_symbols(config, workspace, document)
    expected = [
        ('Unnamed cell 1', 1, 22, 225), ('Imports', 2, 2, 224),
        ('Other cell', 6, 6, 225), ('Unnamed comment 1', 7, 7, 224),
        ('Block comment on a', 9, 9, 224), ('Cell inside a', 10, 14, 225),
        ('Cell', 12, 14, 225), ('Unnamed cell 2', 15, 22, 225),
        ('Pass inside b', 17, 17, 224), ('25', 20, 20, 225),
        ('Unnamed comment 2', 21, 21, 224), ('Empty cell', 23, 24, 225),
        ('Unnamed comment 3', 24, 24, 224)
    ]
    test_results = []
    for symbol in symbols:
        name = symbol['name']
        location = symbol['location']
        sym_range = location['range']
        start = sym_range['start']['line']
        end = sym_range['end']['line']
        kind = symbol['kind']
        test_results.append((name, start, end, kind))
    assert expected == test_results