Debian Codegraph @

tests/data/cases/one_element_subscript.py

raw
1 # We should not treat the trailing comma
2 # in a single-element subscript.
3 a: tuple[int,]
4 b = tuple[int,]
5
6 # The magic comma still applies to multi-element subscripts.
7 c: tuple[int, int,]
8 d = tuple[int, int,]
9
10 # Magic commas still work as expected for non-subscripts.
11 small_list = [1,]
12 list_of_types = [tuple[int,],]
13
14 # output
15 # We should not treat the trailing comma
16 # in a single-element subscript.
17 a: tuple[int,]
18 b = tuple[int,]
19
20 # The magic comma still applies to multi-element subscripts.
21 c: tuple[
22 int,
23 int,
24 ]
25 d = tuple[
26 int,
27 int,
28 ]
29
30 # Magic commas still work as expected for non-subscripts.
31 small_list = [
32 1,
33 ]
34 list_of_types = [
35 tuple[int,],
36 ]