def test_autocomplete(self): """Jedi must complete correct sources.""" response = editor( 'test/jedi_candidates/fixtures/simple.py', 14, 4, 'complete') expected = [ { "name": "test1", "short_doc": "First test function.", "doc": """test1(a, b) First test function.""", }, { "name": "test2", "short_doc": "Second test function.", "doc": """test2(c) Second test function. Accept one argument only.""" }, ] self.assertEqual(response, expected)
def test_empty_references(self): """Strip unknown references.""" response = editor( 'test/jedi_reference/fixtures/useless.py', 1, 4, 'reference') self.assertIsNone(response)
def test_eldoc(self): """Should return signature string.""" response = editor('test/jedi_eldoc/fixtures/simple.py', 8, 5, 'eldoc') expected = ("dump(obj, fp, skipkeys = False, ensure_ascii = True, " "check_circular = True, allow_nan = True, cls = None, " "indent = None, separators = None, default = None, " "sort_keys = False, **kw)") self.assertEqual(response, expected)
def test_doc_search(self): """Jedi must find all assignments documentation.""" response = editor('test/jedi_doc/fixtures/simple.py', 1, 4, 'doc') expected = { 'Document for function f.': '''f(a, b = 1) Document for function f.''', } self.assertEqual(response, expected)
def test_references_search(self): """Jedi must find all references to object.""" response = editor( 'test/jedi_reference/fixtures/simple.py', 1, 4, 'reference') expected = { ROOT + 'test/jedi_reference/fixtures/simple.py:4 - a@4,4': { 'module_path': ROOT + 'test/jedi_reference/fixtures/simple.py', 'line': 4, 'column': 4, 'description': 'a@4,4' }, ROOT + 'test/jedi_reference/fixtures/simple.py:5 - a@5,4': { 'module_path': ROOT + 'test/jedi_reference/fixtures/simple.py', 'line': 5, 'column': 4, 'description': 'a@5,4' } } self.assertEqual(response, expected)
def test_empty_doc(self): """Ignore docless functions.""" response = editor('test/jedi_doc/fixtures/docless.py', 4, 3, 'doc') self.assertIsNone(response)
def test_empty_eldoc(self): """Don't answer eldoc on unknown functions.""" response = editor('test/jedi_eldoc/fixtures/broken.py', 4, 6, 'eldoc') self.assertIsNone(response)
def test_unsupported_command(self): """Ignore adjective commands.""" response = editor('test/jedi/fixtures/simple.py', 2, 11, 'Wrong...') self.assertIsNone(response)