Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 112a799

Browse files
committed
style: textwrap.dedent'ed strings should be indented
Also: fix a mistaken test, it needed a true backslash in the input data Change originally made by an `ick` rule.
1 parent 6bb59f4 commit 112a799

3 files changed

Lines changed: 59 additions & 58 deletions

File tree

coverage/cmdline.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,11 +1187,11 @@ def main_deprecated(argv: list[str] | None = None) -> int | None:
11871187
"""For entry points we'll be getting rid of."""
11881188
print(
11891189
textwrap.dedent("""\
1190-
**
1191-
** This entry point is deprecated and will be removed.
1192-
** Send me an email if you want to keep this command name working:
1193-
1194-
**
1190+
**
1191+
** This entry point is deprecated and will be removed.
1192+
** Send me an email if you want to keep this command name working:
1193+
1194+
**
11951195
""")
11961196
)
11971197
return main(argv)

tests/test_phystokens.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,18 @@ def test_1828(self) -> None:
112112
tokens = list(
113113
source_token_lines(
114114
textwrap.dedent("""
115-
x = \
116-
1
117-
a = ["aaa",\\
118-
"bbb \\
119-
ccc"]
120-
""")
115+
x = \\
116+
1
117+
a = ["aaa",\\
118+
"bbb \\
119+
ccc"]
120+
""")
121121
)
122122
)
123123
assert tokens == [
124124
[],
125-
[("nam", "x"), ("ws", " "), ("op", "="), ("ws", " "), ("num", "1")],
125+
[("nam", "x"), ("ws", " "), ("op", "="), ("ws", " "), ("xx", "\\")],
126+
[("ws", " "), ("num", "1")],
126127
[
127128
("nam", "a"),
128129
("ws", " "),
@@ -159,8 +160,8 @@ def test_fstring_middle(self) -> None:
159160
tokens = list(
160161
source_token_lines(
161162
textwrap.dedent("""\
162-
f'Look: {x} {{x}}!'
163-
""")
163+
f'Look: {x} {{x}}!'
164+
""")
164165
)
165166
)
166167
if env.PYBEHAVIOR.fstring_syntax:

tests/test_regions.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,50 +20,50 @@
2020
def test_code_regions() -> None:
2121
regions = code_regions(
2222
textwrap.dedent("""\
23-
# Numbers in this code are the line number.
24-
'''Module docstring'''
25-
26-
CONST = 4
27-
class MyClass:
28-
class_attr = 6
29-
30-
def __init__(self):
31-
self.x = 9
32-
33-
def method_a(self):
34-
self.x = 12
35-
def inmethod():
36-
self.x = 14
37-
class DeepInside:
38-
def method_b():
39-
self.x = 17
40-
class Deeper:
41-
def bb():
42-
self.x = 20
43-
self.y = 21
44-
45-
class InnerClass:
46-
constant = 24
47-
def method_c(self):
48-
self.x = 26
49-
50-
def func():
51-
x = 29
52-
y = 30
53-
def inner():
54-
z = 32
55-
def inner_inner():
56-
w = 34
57-
58-
class InsideFunc:
59-
def method_d(self):
60-
self.x = 38
61-
62-
return 40
63-
64-
async def afunc():
65-
x = 43
66-
""")
23+
# Numbers in this code are the line number.
24+
'''Module docstring'''
25+
26+
CONST = 4
27+
class MyClass:
28+
class_attr = 6
29+
30+
def __init__(self):
31+
self.x = 9
32+
33+
def method_a(self):
34+
self.x = 12
35+
def inmethod():
36+
self.x = 14
37+
class DeepInside:
38+
def method_b():
39+
self.x = 17
40+
class Deeper:
41+
def bb():
42+
self.x = 20
43+
self.y = 21
44+
45+
class InnerClass:
46+
constant = 24
47+
def method_c(self):
48+
self.x = 26
49+
50+
def func():
51+
x = 29
52+
y = 30
53+
def inner():
54+
z = 32
55+
def inner_inner():
56+
w = 34
57+
58+
class InsideFunc:
59+
def method_d(self):
60+
self.x = 38
61+
62+
return 40
63+
64+
async def afunc():
65+
x = 43
66+
""")
6767
)
6868

6969
F = "function"

0 commit comments

Comments
 (0)