@@ -2689,6 +2689,16 @@ def f(x: *b)
26892689
26902690Asserts:
26912691
2692+ >>> assert (a := 1) # ok
2693+ >>> # TODO(@sobolevn): improve this message in the next PR
2694+ >>> assert a := 1
2695+ Traceback (most recent call last):
2696+ SyntaxError: invalid syntax
2697+
2698+ >>> assert 1 = 2 = 3
2699+ Traceback (most recent call last):
2700+ SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
2701+
26922702 >>> assert 1 = 2
26932703 Traceback (most recent call last):
26942704 SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
@@ -2711,15 +2721,15 @@ def f(x: *b)
27112721
27122722 >>> assert a = 2
27132723 Traceback (most recent call last):
2714- SyntaxError: invalid syntax . Maybe you meant '==' or ': =' instead of '='?
2724+ SyntaxError: cannot assign to name here . Maybe you meant '==' instead of '='?
27152725
27162726 >>> assert (a = 2)
27172727 Traceback (most recent call last):
27182728 SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
27192729
27202730 >>> assert a = b
27212731 Traceback (most recent call last):
2722- SyntaxError: invalid syntax . Maybe you meant '==' or ': =' instead of '='?
2732+ SyntaxError: cannot assign to name here . Maybe you meant '==' instead of '='?
27232733
27242734 >>> assert 1, 1 = b
27252735 Traceback (most recent call last):
@@ -2731,12 +2741,16 @@ def f(x: *b)
27312741
27322742 >>> assert 1, a = 1
27332743 Traceback (most recent call last):
2734- SyntaxError: invalid syntax . Maybe you meant '==' or ': =' instead of '='?
2744+ SyntaxError: cannot assign to name here . Maybe you meant '==' instead of '='?
27352745
27362746 >>> assert 1, (a = 1)
27372747 Traceback (most recent call last):
27382748 SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
27392749
2750+ >>> assert 1 = a, a = 1
2751+ Traceback (most recent call last):
2752+ SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
2753+
27402754"""
27412755
27422756import re
0 commit comments