]> git.madduck.net Git - etc/vim.git/blob - tests/data/pep_572.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Extract formatting tests (#1785)
[etc/vim.git] / tests / data / pep_572.py
1 (a := 1)
2 (a := a)
3 if (match := pattern.search(data)) is None:
4     pass
5 if (match := pattern.search(data)):
6     pass
7 [y := f(x), y ** 2, y ** 3]
8 filtered_data = [y for x in data if (y := f(x)) is None]
9 (y := f(x))
10 y0 = (y1 := f(x))
11 foo(x=(y := f(x)))
12
13
14 def foo(answer=(p := 42)):
15     pass
16
17
18 def foo(answer: (p := 42) = 5):
19     pass
20
21
22 lambda: (x := 1)
23 (x := lambda: 1)
24 (x := lambda: (y := 1))
25 lambda line: (m := re.match(pattern, line)) and m.group(1)
26 x = (y := 0)
27 (z := (y := (x := 0)))
28 (info := (name, phone, *rest))
29 (x := 1, 2)
30 (total := total + tax)
31 len(lines := f.readlines())
32 foo(x := 3, cat="vector")
33 foo(cat=(category := "vector"))
34 if any(len(longline := l) >= 100 for l in lines):
35     print(longline)
36 if env_base := os.environ.get("PYTHONUSERBASE", None):
37     return env_base
38 if self._is_special and (ans := self._check_nans(context=context)):
39     return ans
40 foo(b := 2, a=1)
41 foo((b := 2), a=1)
42 foo(c=(b := 2), a=1)
43
44 while x := f(x):
45     pass
46 while (x := f(x)):
47     pass