Implement magic method return values, fixes #1577

This commit is contained in:
Dave Halter
2020-05-15 19:09:44 +02:00
parent be594f1498
commit 41c146a6f3
4 changed files with 61 additions and 11 deletions

View File

@@ -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()

View File

@@ -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)

View File

@@ -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())