diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-06-24 08:34:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 08:34:28 -0700 |
commit | 11f1a30cdb59f9da0209798d2057f7afacbd9547 (patch) | |
tree | 7c9d8daaf844edde533e5d19744f64c258df4ad4 /Lib/test | |
parent | b3fac2926b23b4f1342099e591aa3fed7f16876d (diff) | |
download | cpython-git-11f1a30cdb59f9da0209798d2057f7afacbd9547.tar.gz |
bpo-44456: Improve the syntax error when mixing keyword and positional patterns (GH-26793)
(cherry picked from commit 0acc258fe6f0ec200ca2f6f9294adbf52a244802)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_syntax.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index e0d0445a83..ad5656bac6 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -1240,6 +1240,30 @@ Corner-cases that used to crash: ... ... Traceback (most recent call last): SyntaxError: invalid pattern target + + >>> match ...: + ... case Foo(z=1, y=2, x): + ... ... + Traceback (most recent call last): + SyntaxError: positional patterns follow keyword patterns + + >>> match ...: + ... case Foo(a, z=1, y=2, x): + ... ... + Traceback (most recent call last): + SyntaxError: positional patterns follow keyword patterns + + >>> match ...: + ... case Foo(z=1, x, y=2): + ... ... + Traceback (most recent call last): + SyntaxError: positional patterns follow keyword patterns + + >>> match ...: + ... case C(a=b, c, d=e, f, g=h, i, j=k, ...): + ... ... + Traceback (most recent call last): + SyntaxError: positional patterns follow keyword patterns """ import re |