mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 18:15:23 +08:00
Implement magic method return values, fixes #1577
This commit is contained in:
@@ -241,7 +241,7 @@ args_func(*1)[0]
|
||||
args_func(*iter([1]))[0]
|
||||
|
||||
# different types
|
||||
e = args_func(*[1+"", {}])
|
||||
e = args_func(*[1 if UNDEFINED else "", {}])
|
||||
#? int() str()
|
||||
e[0]
|
||||
#? dict()
|
||||
|
||||
@@ -5,7 +5,10 @@ def positional_only_call(a, /, b):
|
||||
a
|
||||
#? int()
|
||||
b
|
||||
return a + b
|
||||
if UNDEFINED:
|
||||
return a
|
||||
else:
|
||||
return b
|
||||
|
||||
|
||||
#? int() str()
|
||||
@@ -13,7 +16,10 @@ positional_only_call('', 1)
|
||||
|
||||
|
||||
def positional_only_call2(a, /, b=3):
|
||||
return a + b
|
||||
if UNDEFINED:
|
||||
return a
|
||||
else:
|
||||
return b
|
||||
|
||||
#? int()
|
||||
positional_only_call2(1)
|
||||
|
||||
@@ -56,7 +56,7 @@ a
|
||||
(3 ** 3)
|
||||
#? int() str()
|
||||
(3 ** 'a')
|
||||
#? int() str()
|
||||
#? int()
|
||||
(3 + 'a')
|
||||
#? bool()
|
||||
(3 == 'a')
|
||||
@@ -147,3 +147,18 @@ a = foobarbaz + 'hello'
|
||||
|
||||
#? int() float()
|
||||
{'hello': 1, 'bar': 1.0}[a]
|
||||
|
||||
# -----------------
|
||||
# stubs
|
||||
# -----------------
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
#?
|
||||
(datetime - timedelta)
|
||||
#? datetime()
|
||||
(datetime() - timedelta())
|
||||
#? timedelta()
|
||||
(timedelta() - datetime())
|
||||
#? timedelta()
|
||||
(timedelta() - timedelta())
|
||||
|
||||
Reference in New Issue
Block a user