summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r--Lib/test/test_grammar.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 6d7d554..2a3b71f 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -620,14 +620,22 @@ class GrammarTests(unittest.TestCase):
self.assertEqual(f.__annotations__, {'return': list})
def f(x: int): pass
self.assertEqual(f.__annotations__, {'x': int})
+ def f(x: int, /): pass
+ self.assertEqual(f.__annotations__, {'x': int})
+ def f(x: int = 34, /): pass
+ self.assertEqual(f.__annotations__, {'x': int})
def f(*x: str): pass
self.assertEqual(f.__annotations__, {'x': str})
def f(**x: float): pass
self.assertEqual(f.__annotations__, {'x': float})
def f(x, y: 1+2): pass
self.assertEqual(f.__annotations__, {'y': 3})
+ def f(x, y: 1+2, /): pass
+ self.assertEqual(f.__annotations__, {'y': 3})
def f(a, b: 1, c: 2, d): pass
self.assertEqual(f.__annotations__, {'b': 1, 'c': 2})
+ def f(a, b: 1, /, c: 2, d): pass
+ self.assertEqual(f.__annotations__, {'b': 1, 'c': 2})
def f(a, b: 1, c: 2, d, e: 3 = 4, f=5, *g: 6): pass
self.assertEqual(f.__annotations__,
{'b': 1, 'c': 2, 'e': 3, 'g': 6})
@@ -636,6 +644,11 @@ class GrammarTests(unittest.TestCase):
self.assertEqual(f.__annotations__,
{'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9,
'k': 11, 'return': 12})
+ def f(a, b: 1, c: 2, d, e: 3 = 4, f: int = 5, /, *g: 6, h: 7, i=8, j: 9 = 10,
+ **k: 11) -> 12: pass
+ self.assertEqual(f.__annotations__,
+ {'b': 1, 'c': 2, 'e': 3, 'f': int, 'g': 6, 'h': 7, 'j': 9,
+ 'k': 11, 'return': 12})
# Check for issue #20625 -- annotations mangling
class Spam:
def f(self, *, __kw: 1):