mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-15 06:41:06 +08:00
test for #178, docstring type annotations should be executed
This commit is contained in:
1 parent
28fbdbc0f6
commit
e681ed9fda
1 file changed
+28
@@ -2,6 +2,7 @@
|
||||
Testing of docstring related issues and especially ``jedi.docstrings``.
|
||||
"""
|
||||
|
||||
from textwrap import dedent
|
||||
import jedi
|
||||
from ..helpers import unittest
|
||||
|
||||
@@ -59,3 +60,30 @@ class TestDocstring(unittest.TestCase):
|
||||
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
assert 'join' in names
|
||||
|
||||
def test_docstring_instance(self):
|
||||
# The types hint that it's a certain kind
|
||||
s = dedent("""
|
||||
class A:
|
||||
def __init__(self,a):
|
||||
'''
|
||||
:type a: threading.Thread
|
||||
'''
|
||||
|
||||
if a is not None:
|
||||
a.start()
|
||||
|
||||
self.a = a
|
||||
|
||||
|
||||
def method_b(c):
|
||||
'''
|
||||
:type c: A
|
||||
'''
|
||||
|
||||
c.""")
|
||||
|
||||
names = [c.name for c in jedi.Script(s).completions()]
|
||||
assert 'a' in names
|
||||
assert '__init__' in names
|
||||
assert 'mro' not in names # Exists only for types.
|
||||
Reference in new issue
Block a user