mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-25 02:57:22 +08:00
Get a first typeshed example fully working as intended
This commit is contained in:
1 parent
c8caa8f4ac
commit
61de28f741
3 files changed
+101
-103
No files matched your search
@@ -48,16 +48,23 @@ def test_function(Script):
|
||||
|
||||
|
||||
def test_class(Script):
|
||||
def_, = Script('import threading; threading.Lock').goto_definitions()
|
||||
def_, = Script('import threading; threading.Thread').goto_definitions()
|
||||
context = def_._name._context
|
||||
assert isinstance(context, typeshed.ClassStubContext), context
|
||||
|
||||
|
||||
def test_instance(Script):
|
||||
s = Script('import threading; threading.Lock()')
|
||||
s = Script('import threading; threading.Thread()')
|
||||
|
||||
|
||||
def test_class_function(Script):
|
||||
def_, = Script('import threading; threading.Thread.getName').goto_definitions()
|
||||
context = def_._name._context
|
||||
assert isinstance(context, typeshed.FunctionStubContext), context
|
||||
|
||||
|
||||
def test_method(Script):
|
||||
s = Script('import threading; threading.Lock().locked')
|
||||
|
||||
|
||||
code = 'import threading; threading.Thread().getName'
|
||||
def_, = Script(code).goto_definitions()
|
||||
context = def_._name._context
|
||||
assert isinstance(context, typeshed.ClassStubContext), context
|
||||
Reference in new issue
Block a user