Example #1
0
def test_import_line():
    line = "import vim_monty."
    compls = completion('\n\n', line, 1, len(line), '')
    assert PACKAGE_MODULES == compls

    line = "from vim_monty."
    compls = completion('\n\n', line, 1, len(line), '')
    assert PACKAGE_MODULES == compls
Example #2
0
def test_import_line():
    line = "import vim_monty."
    compls = completion('\n\n', line, 1, len(line), '')
    assert PACKAGE_MODULES == compls

    line = "from vim_monty."
    compls = completion('\n\n', line, 1, len(line), '')
    assert PACKAGE_MODULES == compls
Example #3
0
def test_from():
    line = 'BClass.'
    compls = AModule.completion(line)
    assert 'b_class_method' in compls

    # Test of a deeper from import, BClass is also imported by 'a_module'.
    python_code = 'from a_module import BClass\n\n'
    compls = completion(python_code, line, 2, len(line), '')
    assert 'b_class_method' in compls
Example #4
0
def test_from():
    line = 'BClass.'
    compls = AModule.completion(line)
    assert 'b_class_method' in compls

    # Test of a deeper from import, BClass is also imported by 'a_module'.
    python_code = 'from a_module import BClass\n\n'
    compls = completion(python_code, line, 2, len(line), '')
    assert 'b_class_method' in compls
Example #5
0
def test_from_line():
    line = "from vim_monty import "
    compls = completion('\n\n', line, 1, len(line), '')
    expect = sorted(PACKAGE_MODULES + [
        'completion',
        'find_base_column',
        'reload_submodules',
        'vim_completion_builder',
    ])
    assert expect == compls
Example #6
0
def test_from_line():
    line = "from vim_monty import "
    compls = completion('\n\n', line, 1, len(line), '')
    expect = sorted(PACKAGE_MODULES + [
                    'completion',
                    'find_base_column',
                    'reload_submodules',
                    'vim_completion_builder',
    ])
    assert expect == compls
Example #7
0
def test_imported():
    python_code = "import a_module\na_module.\n"
    compls = completion(python_code, 'a_module.', 2, 8, '')
    assert AModule.GLOBALS == compls
Example #8
0
 def completion(cls, line, linenumber=None, column=None, base=''):
     if linenumber is None:
         linenumber = AModule.LAST_LINE
     if column is None:
         column = len(line)
     return completion(cls.SOURCE, line, linenumber, column, base)
Example #9
0
def test_imported():
    python_code = "import a_module\na_module.\n"
    compls = completion(python_code, 'a_module.', 2, 8, '')
    assert AModule.GLOBALS == compls
Example #10
0
 def completion(cls, line, linenumber=None, column=None, base=''):
     if linenumber is None:
         linenumber = AModule.LAST_LINE
     if column is None:
         column = len(line)
     return completion(cls.SOURCE, line, linenumber, column, base)