mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
All modules now have a code_lines attribute, see #1062
This commit is contained in:
@@ -71,3 +71,22 @@ def test_nested_namedtuples(Script):
|
||||
train_x.train.'''
|
||||
))
|
||||
assert 'data' in [c.name for c in s.completions()]
|
||||
|
||||
|
||||
def test_namedtuple_goto_definitions(Script):
|
||||
source = dedent("""
|
||||
from collections import namedtuple
|
||||
|
||||
Foo = namedtuple('Foo', 'id timestamp gps_timestamp attributes')
|
||||
Foo""")
|
||||
|
||||
from jedi.api import Script
|
||||
|
||||
lines = source.split("\n")
|
||||
d1, = Script(source).goto_definitions()
|
||||
|
||||
print(d1)
|
||||
print(d1.line)
|
||||
print(d1.module_path)
|
||||
print(d1.get_line_code())
|
||||
assert d1.get_line_code() == lines[-1]
|
||||
|
||||
Reference in New Issue
Block a user