]> git.madduck.net Git - etc/vim.git/blob - tests/data/simple_cases/skip_magic_trailing_comma.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:

Fix unintentionally swapped words in index.md (#3809)
[etc/vim.git] / tests / data / simple_cases / skip_magic_trailing_comma.py
1 # We should not remove the trailing comma in a single-element subscript.
2 a: tuple[int,]
3 b = tuple[int,]
4
5 # But commas in multiple element subscripts should be removed.
6 c: tuple[int, int,]
7 d = tuple[int, int,]
8
9 # Remove commas for non-subscripts.
10 small_list = [1,]
11 list_of_types = [tuple[int,],]
12 small_set = {1,}
13 set_of_types = {tuple[int,],}
14
15 # Except single element tuples
16 small_tuple = (1,)
17
18 # Trailing commas in multiple chained non-nested parens.
19 zero(
20     one,
21 ).two(
22     three,
23 ).four(
24     five,
25 )
26
27 func1(arg1).func2(arg2,).func3(arg3).func4(arg4,).func5(arg5)
28
29 (
30     a,
31     b,
32     c,
33     d,
34 ) = func1(
35     arg1
36 ) and func2(arg2)
37
38 func(
39     argument1,
40     (
41         one,
42         two,
43     ),
44     argument4,
45     argument5,
46     argument6,
47 )
48
49 # output
50 # We should not remove the trailing comma in a single-element subscript.
51 a: tuple[int,]
52 b = tuple[int,]
53
54 # But commas in multiple element subscripts should be removed.
55 c: tuple[int, int]
56 d = tuple[int, int]
57
58 # Remove commas for non-subscripts.
59 small_list = [1]
60 list_of_types = [tuple[int,]]
61 small_set = {1}
62 set_of_types = {tuple[int,]}
63
64 # Except single element tuples
65 small_tuple = (1,)
66
67 # Trailing commas in multiple chained non-nested parens.
68 zero(one).two(three).four(five)
69
70 func1(arg1).func2(arg2).func3(arg3).func4(arg4).func5(arg5)
71
72 (a, b, c, d) = func1(arg1) and func2(arg2)
73
74 func(argument1, (one, two), argument4, argument5, argument6)