Lines Matching +full:self +full:- +full:assign
12 raise these exceptions-- ast.c, compile.c, future.c, pythonrun.c, and
36 SyntaxError: cannot assign to None
44 SyntaxError: cannot assign to True
52 SyntaxError: cannot assign to __debug__
56 SyntaxError: cannot assign to __debug__
60 SyntaxError: cannot assign to __debug__
68 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
80 SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
84 SyntaxError: cannot assign to generator expression
88 SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
92 SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
96 SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
100 SyntaxError: cannot assign to ellipsis here. Maybe you meant '==' instead of '='?
106 If the left-hand side of an assignment is a list or tuple, an illegal
113 SyntaxError: cannot assign to literal
117 SyntaxError: cannot assign to True
121 SyntaxError: cannot assign to __debug__
125 SyntaxError: cannot assign to True
129 SyntaxError: cannot assign to __debug__
133 SyntaxError: cannot assign to expression
137 SyntaxError: cannot assign to expression
141 SyntaxError: cannot assign to expression
145 SyntaxError: cannot assign to conditional expression
169 SyntaxError: cannot assign to True
173 SyntaxError: cannot assign to True
196 SyntaxError: cannot assign to function call
200 SyntaxError: cannot assign to function call
204 SyntaxError: cannot assign to function call
208 SyntaxError: cannot assign to expression
212 SyntaxError: cannot assign to function call
216 SyntaxError: cannot assign to function call
220 SyntaxError: cannot assign to expression
232 SyntaxError: cannot assign to function call
236 SyntaxError: cannot assign to function call
240 SyntaxError: cannot assign to function call
244 SyntaxError: cannot assign to expression
248 SyntaxError: cannot assign to function call
252 SyntaxError: cannot assign to function call
337 SyntaxError: non-default argument follows default argument
392 SyntaxError: var-positional argument cannot have default value
397 SyntaxError: var-positional argument cannot have default value
402 SyntaxError: var-keyword argument cannot have default value
407 SyntaxError: var-keyword argument cannot have default value
412 SyntaxError: arguments cannot follow var-keyword argument
417 SyntaxError: arguments cannot follow var-keyword argument
422 SyntaxError: arguments cannot follow var-keyword argument
427 SyntaxError: arguments cannot follow var-keyword argument
432 SyntaxError: arguments cannot follow var-keyword argument
508 SyntaxError: var-positional argument cannot have default value
512 SyntaxError: var-keyword argument cannot have default value
516 SyntaxError: arguments cannot follow var-keyword argument
520 SyntaxError: arguments cannot follow var-keyword argument
524 SyntaxError: arguments cannot follow var-keyword argument
528 SyntaxError: arguments cannot follow var-keyword argument
532 SyntaxError: arguments cannot follow var-keyword argument
681 ... def meth(self, *args):
733 SyntaxError: cannot assign to True
736 SyntaxError: cannot assign to False
739 SyntaxError: cannot assign to None
742 SyntaxError: cannot assign to __debug__
745 SyntaxError: cannot assign to __debug__
758 SyntaxError: cannot assign to __debug__
828 uses a single data structure to keep track of try-finally and loops,
909 ... def f(self):
916 This tests assignment-context; there was a bug in Python 2.5 where compiling
926 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
934 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
944 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
954 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
964 SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?
1119 SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
1124 SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?
1532 SyntaxError: cannot assign to set display here. Maybe you meant '==' instead of '='?
1536 SyntaxError: cannot assign to dict literal here. Maybe you meant '==' instead of '='?
1540 SyntaxError: cannot assign to f-string expression here. Maybe you meant '==' instead of '='?
1542 >>> f'{x}-{y}' = 42
1544 SyntaxError: cannot assign to f-string expression here. Maybe you meant '==' instead of '='?
1594 Corner-cases that used to fail to raise the correct error:
1598 SyntaxError: cannot assign to __debug__
1602 SyntaxError: cannot assign to __debug__
1606 SyntaxError: cannot assign to __debug__
1612 Corner-cases that used to crash:
1616 SyntaxError: cannot assign to __debug__
1620 SyntaxError: cannot assign to __debug__
1840 def _check_error(self, code, errtext, argument
1853 self.fail("SyntaxError is not a %s" % subclass.__name__)
1856 self.fail("SyntaxError did not contain %r" % (errtext,))
1857 self.assertEqual(err.filename, filename)
1859 self.assertEqual(err.lineno, lineno)
1861 self.assertEqual(err.offset, offset)
1863 self.assertEqual(err.end_lineno, end_lineno)
1865 self.assertEqual(err.end_offset, end_offset)
1868 self.fail("compile() did not raise SyntaxError")
1870 def test_expression_with_assignment(self): argument
1871 self._check_error(
1877 def test_curly_brace_after_primary_raises_immediately(self): argument
1878 self._check_error("f{}", "invalid syntax", mode="single")
1880 def test_assign_call(self): argument
1881 self._check_error("f() = 1", "assign")
1883 def test_assign_del(self): argument
1884 self._check_error("del (,)", "invalid syntax")
1885 self._check_error("del 1", "cannot delete literal")
1886 self._check_error("del (1, 2)", "cannot delete literal")
1887 self._check_error("del None", "cannot delete None")
1888 self._check_error("del *x", "cannot delete starred")
1889 self._check_error("del (*x)", "cannot use starred expression")
1890 self._check_error("del (*x,)", "cannot delete starred")
1891 self._check_error("del [*x,]", "cannot delete starred")
1892 self._check_error("del f()", "cannot delete function call")
1893 self._check_error("del f(a, b)", "cannot delete function call")
1894 self._check_error("del o.f()", "cannot delete function call")
1895 self._check_error("del a[0]()", "cannot delete function call")
1896 self._check_error("del x, f()", "cannot delete function call")
1897 self._check_error("del f(), x", "cannot delete function call")
1898 self._check_error("del [a, b, ((c), (d,), e.f())]", "cannot delete function call")
1899 self._check_error("del (a if True else b)", "cannot delete conditional")
1900 self._check_error("del +a", "cannot delete expression")
1901 self._check_error("del a, +b", "cannot delete expression")
1902 self._check_error("del a + b", "cannot delete expression")
1903 self._check_error("del (a + b, c)", "cannot delete expression")
1904 self._check_error("del (c[0], a + b)", "cannot delete expression")
1905 self._check_error("del a.b.c + 2", "cannot delete expression")
1906 self._check_error("del a.b.c[0] + 2", "cannot delete expression")
1907 self._check_error("del (a, b, (c, d.e.f + 2))", "cannot delete expression")
1908 self._check_error("del [a, b, (c, d.e.f[0] + 2)]", "cannot delete expression")
1909 self._check_error("del (a := 5)", "cannot delete named expression")
1912 self._check_error("del a += b", "invalid syntax")
1914 def test_global_param_err_first(self): argument
1922 self._check_error(source, "parameter and global", lineno=3)
1924 def test_nonlocal_param_err_first(self): argument
1932 self._check_error(source, "parameter and nonlocal", lineno=3)
1934 def test_yield_outside_function(self): argument
1935 self._check_error("if 0: yield", "outside function")
1936 self._check_error("if 0: yield\nelse: x=1", "outside function")
1937 self._check_error("if 1: pass\nelse: yield", "outside function")
1938 self._check_error("while 0: yield", "outside function")
1939 self._check_error("while 0: yield\nelse: x=1", "outside function")
1940 self._check_error("class C:\n if 0: yield", "outside function")
1941 self._check_error("class C:\n if 1: pass\n else: yield",
1943 self._check_error("class C:\n while 0: yield", "outside function")
1944 self._check_error("class C:\n while 0: yield\n else: x = 1",
1947 def test_return_outside_function(self): argument
1948 self._check_error("if 0: return", "outside function")
1949 self._check_error("if 0: return\nelse: x=1", "outside function")
1950 self._check_error("if 1: pass\nelse: return", "outside function")
1951 self._check_error("while 0: return", "outside function")
1952 self._check_error("class C:\n if 0: return", "outside function")
1953 self._check_error("class C:\n while 0: return", "outside function")
1954 self._check_error("class C:\n while 0: return\n else: x=1",
1956 self._check_error("class C:\n if 0: return\n else: x= 1",
1958 self._check_error("class C:\n if 1: pass\n else: return",
1961 def test_break_outside_loop(self): argument
1963 self._check_error("break", msg, lineno=1)
1964 self._check_error("if 0: break", msg, lineno=1)
1965 self._check_error("if 0: break\nelse: x=1", msg, lineno=1)
1966 self._check_error("if 1: pass\nelse: break", msg, lineno=2)
1967 self._check_error("class C:\n if 0: break", msg, lineno=2)
1968 self._check_error("class C:\n if 1: pass\n else: break",
1970 self._check_error("with object() as obj:\n break",
1973 def test_continue_outside_loop(self): argument
1975 self._check_error("if 0: continue", msg, lineno=1)
1976 self._check_error("if 0: continue\nelse: x=1", msg, lineno=1)
1977 self._check_error("if 1: pass\nelse: continue", msg, lineno=2)
1978 self._check_error("class C:\n if 0: continue", msg, lineno=2)
1979 self._check_error("class C:\n if 1: pass\n else: continue",
1981 self._check_error("with object() as obj:\n continue",
1984 def test_unexpected_indent(self): argument
1985 self._check_error("foo()\n bar()\n", "unexpected indent",
1988 def test_no_indent(self): argument
1989 self._check_error("if 1:\nfoo()", "expected an indented block",
1992 def test_bad_outdent(self): argument
1993 self._check_error("if 1:\n foo()\n bar()",
1997 def test_kwargs_last(self): argument
1998 self._check_error("int(base=10, '2')",
2001 def test_kwargs_last2(self): argument
2002 self._check_error("int(**{'base': 10}, '2')",
2006 def test_kwargs_last3(self): argument
2007 self._check_error("int(**{'base': 10}, *['2'])",
2011 def test_generator_in_function_call(self): argument
2012 self._check_error("foo(x, y for y in range(3) for z in range(2) if z , p)",
2016 def test_except_then_except_star(self): argument
2017 self._check_error("try: pass\nexcept ValueError: pass\nexcept* TypeError: pass",
2021 def test_except_star_then_except(self): argument
2022 self._check_error("try: pass\nexcept* ValueError: pass\nexcept TypeError: pass",
2026 def test_empty_line_after_linecont(self): argument
2027 # See issue-40847
2037 self.fail("Empty line after a line continuation character is valid.")
2039 # See issue-46091
2056 self.fail("Indented statement over multiple lines is valid")
2058 def test_continuation_bad_indentation(self): argument
2068 self.assertRaises(IndentationError, exec, code)
2071 def test_nested_named_except_blocks(self): argument
2078 self._check_error(code, "too many statically nested blocks")
2080 def test_barry_as_flufl_with_syntax_errors(self): argument
2081 # The "barry_as_flufl" rule can produce some "bugs-at-a-distance" if
2083 # in the file. See bpo-42214 for more information.
2095 self._check_error(code, "expected ':'")
2097 def test_invalid_line_continuation_error_position(self): argument
2098 self._check_error(r"a = 3 \ 4",
2101 self._check_error('1,\\#\n2',
2104 self._check_error('\nfgdfgf\n1,\\#\n2\n',
2108 def test_invalid_line_continuation_left_recursive(self): argument
2109 # Check bpo-42218: SyntaxErrors following left-recursive rules
2111 self._check_error("A.\u018a\\ ",
2113 self._check_error("A.\u03bc\\\n",
2116 def test_error_parenthesis(self): argument
2118 self._check_error(paren + "1 + 2", f"\\{paren}' was never closed")
2121 self._check_error(f"a = {paren} 1, 2, 3\nb=3", f"\\{paren}' was never closed")
2124 self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
2133 self._check_error(code, "parenthesis '\\)' does not match opening parenthesis '\\['")
2135 def test_error_string_literal(self): argument
2137 self._check_error("'blech", "unterminated string literal")
2138 self._check_error('"blech', "unterminated string literal")
2139 self._check_error("'''blech", "unterminated triple-quoted string literal")
2140 self._check_error('"""blech', "unterminated triple-quoted string literal")
2142 def test_invisible_characters(self): argument
2143 self._check_error('print\x17("Hello")', "invalid non-printable character")
2145 def test_match_call_does_not_raise_syntax_error(self): argument
2154 def test_case_call_does_not_raise_syntax_error(self): argument
2163 def test_multiline_compiler_error_points_to_the_end(self): argument
2164 self._check_error(
2171 def test_syntax_error_on_deeply_nested_blocks(self): argument
2203 self._check_error(source, "too many statically nested blocks")
2206 def test_error_on_parser_stack_overflow(self): argument
2207 source = "-" * 100000 + "4"
2209 with self.subTest(mode=mode):
2210 with self.assertRaises(MemoryError):
2214 def test_deep_invalid_rule(self): argument
2218 with self.assertRaises(SyntaxError):