blob: a5527107978a80aaaf5a00a9ade579f1c4dfdc13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
"""Bad continuations in dictionary comprehensions."""
__revision__ = 0
# Dictionary comprehensions should not require extra indentation when breaking
# before the 'for', which is not part of the value
C1 = {'key{}'.format(x): 'value{}'.format(x)
for x in range(3)}
C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
range(3)}
# Dictionary comprehensions with multiple loops broken in different places
C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
C4 = {x*y: (x, y)
for x in range(3) for y in range(3)}
C5 = {x*y: (x, y) for x
in range(3) for y in range(3)}
C6 = {x*y: (x, y) for x in range(3)
for y in range(3)}
C7 = {key:
key ** 2
for key in range(10)}
C8 = {
key: key ** 2
for key in range(10)}
# Misaligned cases for dict comprehensions
C9 = {'key{}'.format(x): 'value{}'.format(x)
for x in range(3)} # [bad-continuation]
C9 = {'key{}'.format(x): 'value{}'.format(x)
for x in range(3)} # [bad-continuation]
|