Update black tests (#10166) · astral-sh/ruff@dcc92f5 (original) (raw)

139 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
1 +def foo():
2 +"""
3 + Docstring
4 + """
5 +
6 +# Here we go
7 +if x:
8 +
9 +# This is also now fine
10 +a = 123
11 +
12 +else:
13 +# But not necessary
14 +a = 123
15 +
16 +if y:
17 +
18 +while True:
19 +
20 +"""
21 + Long comment here
22 + """
23 +a = 123
24 +
25 +if z:
26 +
27 +for _ in range(100):
28 +a = 123
29 +else:
30 +
31 +try:
32 +
33 +# this should be ok
34 +a = 123
35 +except:
36 +
37 +"""also this"""
38 +a = 123
39 +
40 +
41 +def bar():
42 +
43 +if x:
44 +a = 123
45 +
46 +
47 +def baz():
48 +
49 +# OK
50 +if x:
51 +a = 123
52 +
53 +def quux():
54 +
55 +new_line = here
56 +
57 +
58 +class Cls:
59 +
60 +def method(self):
61 +
62 +pass
63 +
64 +
65 +async def async_fn():
66 +
67 +"""Docstring."""
68 +
69 +
70 +@decorated
71 +async def async_fn():
72 +
73 +"""Docstring."""
74 +
75 +
76 +def top_level(
77 +a: int,
78 +b: str,
79 +) -> Whatever[Generic, Something]:
80 +
81 +def nested(x: int) -> int:
82 +pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
1 +def foo():
2 + """
3 + Docstring
4 + """
5 +
6 + # Here we go
7 + if x:
8 +
9 + # This is also now fine
10 + a = 123
11 +
12 + else:
13 + # But not necessary
14 + a = 123
15 +
16 + if y:
17 +
18 + while True:
19 +
20 + """
21 + Long comment here
22 + """
23 + a = 123
24 +
25 + if z:
26 +
27 + for _ in range(100):
28 + a = 123
29 + else:
30 +
31 + try:
32 +
33 + # this should be ok
34 + a = 123
35 + except:
36 +
37 + """also this"""
38 + a = 123
39 +
40 +
41 +def bar():
42 +
43 + if x:
44 + a = 123
45 +
46 +
47 +def baz():
48 +
49 + # OK
50 + if x:
51 + a = 123
52 +
53 +
54 +def quux():
55 +
56 + new_line = here
57 +
58 +
59 +class Cls:
60 +
61 + def method(self):
62 +
63 + pass
64 +
65 +
66 +async def async_fn():
67 + """Docstring."""
68 +
69 +
70 +@decorated
71 +async def async_fn():
72 + """Docstring."""
73 +
74 +
75 +def top_level(
76 + a: int,
77 + b: str,
78 +) -> Whatever[Generic, Something]:
79 +
80 + def nested(x: int) -> int:
81 + pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1 +async def func() -> (int):
2 +return 0
3 +
4 +
5 +@decorated
6 +async def func() -> (int):
7 +return 0
8 +
9 +
10 +async for (item) in async_iter:
11 +pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
1 +async def func() -> int:
2 + return 0
3 +
4 +
5 +@decorated
6 +async def func() -> int:
7 + return 0
8 +
9 +
10 +async for item in async_iter:
11 + pass
Original file line number Diff line number Diff line change
@@ -45,17 +45,15 @@ def wat():
45 45 @deco2(with_args=True)
46 46 # leading 3
47 47 @deco3
48 -def decorated1():
49 - ...
48 +def decorated1(): ...
50 49
51 50
52 51 # leading 1
53 52 @deco1
54 53 # leading 2
55 54 @deco2(with_args=True)
56 55 # leading function comment
57 -def decorated1():
58 - ...
56 +def decorated1(): ...
59 57
60 58
61 59 # Note: this is fixed in
@@ -65,8 +63,7 @@ def decorated1():
65 63
66 64
67 65 # This comment should be split from `some_instruction` by two lines but isn't.
68 -def g():
69 - ...
66 +def g(): ...
70 67
71 68
72 69 if __name__ == "__main__":
Original file line number Diff line number Diff line change
@@ -45,17 +45,15 @@ def wat():
45 45 @deco2(with_args=True)
46 46 # leading 3
47 47 @deco3
48 -def decorated1():
49 - ...
48 +def decorated1(): ...
50 49
51 50
52 51 # leading 1
53 52 @deco1
54 53 # leading 2
55 54 @deco2(with_args=True)
56 55 # leading function comment
57 -def decorated1():
58 - ...
56 +def decorated1(): ...
59 57
60 58
61 59 # Note: this is fixed in
@@ -65,8 +63,7 @@ some_instruction
65 63
66 64
67 65 # This comment should be split from `some_instruction` by two lines but isn't.
68 -def g():
69 - ...
66 +def g(): ...
70 67
71 68
72 69 if __name__ == "__main__":
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
1 +if (
2 +True
3 +# sdf
4 +):
5 +print("hw")
6 +
7 +if ((
8 +True
9 +# sdf
10 +)):
11 +print("hw")
12 +
13 +if ((
14 +# type: ignore
15 +True
16 +)):
17 +print("hw")
18 +
19 +if ((
20 +True
21 +# type: ignore
22 +)):
23 +print("hw")
24 +
25 +if (
26 +# a long comment about
27 +# the condition below
28 + (a or b)
29 +):
30 +pass
31 +
32 +def return_true():
33 +return (
34 + (
35 +True # this comment gets removed accidentally
36 + )
37 + )
38 +
39 +def return_true():
40 +return (True) # this comment gets removed accidentally
41 +
42 +
43 +if (
44 +# huh comment
45 + (True)
46 +):
47 + ...
48 +
49 +if (
50 +# huh
51 + (
52 +# comment
53 +True
54 + )
55 +):
56 + ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
1 +if (
2 + True
3 + # sdf
4 +):
5 + print("hw")
6 +
7 +if (
8 + True
9 + # sdf
10 +):
11 + print("hw")
12 +
13 +if (
14 + # type: ignore
15 + True
16 +):
17 + print("hw")
18 +
19 +if (
20 + True
21 + # type: ignore
22 +):
23 + print("hw")
24 +
25 +if (
26 + # a long comment about
27 + # the condition below
28 + a
29 + or b
30 +):
31 + pass
32 +
33 +
34 +def return_true():
35 + return True # this comment gets removed accidentally
36 +
37 +
38 +def return_true():
39 + return True # this comment gets removed accidentally
40 +
41 +
42 +if (
43 + # huh comment
44 + True
45 +):
46 + ...
47 +
48 +if (
49 + # huh
50 + # comment
51 + True
52 +):
53 + ...
Original file line number Diff line number Diff line change
@@ -104,7 +104,9 @@ def foo(wait: bool = True):
104 104 time.sleep(1) if wait else None
105 105
106 106
107 -a = "".join((
108 - "", # comment
109 - "" if True else "",
110 -))
107 +a = "".join(
108 + (
109 + "", # comment
110 + "" if True else "",
111 + )
112 +)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 +{"target_version": "py38"}