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

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