@@ -70,8 +70,8 @@ def test_lock_doesnt_accept_loop_parameter(self):
70
70
):
71
71
cls (loop = self .loop )
72
72
73
- # Barrier object has a positional paramater
74
- # so check alone
73
+ # Barrier object has a positional paramater
74
+ # so check alone
75
75
cls = asyncio .Barrier
76
76
with self .assertRaisesRegex (
77
77
TypeError ,
@@ -947,7 +947,7 @@ class BarrierTests(test_utils.TestCase):
947
947
def setUp (self ):
948
948
super ().setUp ()
949
949
self .loop = self .new_test_loop ()
950
- self .N = 5
950
+ self .N = 5
951
951
952
952
async def run_coros (self , n , coro ):
953
953
tasks = [self .loop .create_task (coro ()) for _ in range (n )]
@@ -969,8 +969,8 @@ async def coro():
969
969
self .assertTrue (f"count:0/{ str (self .N )} " in repr (barrier ))
970
970
self .assertTrue (RGX_REPR .match (repr (barrier )))
971
971
self .assertTrue (repr (barrier ).endswith ('unset, state:0]>' ))
972
-
973
- nb_waits = 3
972
+
973
+ nb_waits = 3
974
974
tasks = []
975
975
for _ in range (nb_waits ):
976
976
tasks .append (self .loop .create_task (coro ()))
@@ -1002,16 +1002,16 @@ def test_init(self):
1002
1002
se
9E81
lf .assertRaises (ValueError , lambda : asyncio .Barrier (0 ))
1003
1003
self .assertRaises (ValueError , lambda : asyncio .Barrier (- 4 ))
1004
1004
1005
- def test_wait (self ):
1005
+ def test_wait_more (self ):
1006
1006
async def coro (result ):
1007
1007
r = await barrier .wait ()
1008
1008
result .append (r )
1009
-
1009
+
1010
1010
barrier = asyncio .Barrier (self .N )
1011
1011
results = []
1012
1012
_ = [self .loop .create_task (coro (results )) for _ in range (self .N )]
1013
1013
test_utils .run_briefly (self .loop )
1014
- self .assertEqual (sum (results ), sum (range (self .N )))
1014
+ self .assertEqual (sum (results ), sum (range (self .N )))
1015
1015
self .assertFalse (barrier .broken )
1016
1016
1017
1017
def test_wait_task_multi (self ):
@@ -1029,7 +1029,7 @@ def test_wait_task_multi(self):
1029
1029
self .assertEqual (barrier .n_waiting , 0 )
1030
1030
self .assertFalse (barrier .broken )
1031
1031
1032
- def test_wait_task (self ):
1032
+ def test_wait_task_one (self ):
1033
1033
self .N = 1
1034
1034
barrier = asyncio .Barrier (self .N )
1035
1035
r1 = self .loop .run_until_complete (barrier .wait ())
@@ -1115,7 +1115,7 @@ async def coro(result, value):
1115
1115
value = 1
1116
1116
barrier = asyncio .Barrier (1 , action = lambda : result1 .append (True ))
1117
1117
_ = [self .loop .create_task (coro (result , value )) for _ in range (self .N )]
1118
- test_utils .run_briefly (self .loop )
1118
+ test_utils .run_briefly (self .loop )
1119
1119
1120
1120
self .assertEqual (len (result1 ), self .N )
1121
1121
self .assertTrue (all (result1 ))
@@ -1134,7 +1134,7 @@ async def coro(result, value):
1134
1134
value = 1
1135
1135
barrier = asyncio .Barrier (self .N , action = lambda : result1 .append (True ))
1136
1136
_ = [self .loop .create_task (coro (result , value )) for _ in range (self .N )]
1137
- test_utils .run_briefly (self .loop )
1137
+ test_utils .run_briefly (self .loop )
1138
1138
1139
1139
self .assertEqual (len (result1 ), 1 )
1140
1140
self .assertTrue (result1 [0 ])
@@ -1173,9 +1173,9 @@ def test_reset(self):
1173
1173
results1 = []
1174
1174
results2 = []
1175
1175
async def coro ():
1176
- try :
1176
+ try :
1177
1177
await barrier .wait ()
1178
- except asyncio .BrokenBarrierError :
1178
+ except asyncio .BrokenBarrierError :
1179
1179
results1 .append (True )
1180
1180
finally :
1181
1181
await barrier .wait ()
@@ -1217,7 +1217,7 @@ async def coro():
1217
1217
# Now, pass the barrier again
1218
1218
await barrier1 .wait ()
1219
1219
results3 .append (True )
1220
-
1220
+
1221
1221
barrier = asyncio .Barrier (self .N )
1222
1222
barrier1 = asyncio .Barrier (self .N )
1223
1223
res , tasks = self .loop .run_until_complete (self .run_coros (self .N , coro ))
@@ -1235,7 +1235,7 @@ async def coro():
1235
1235
if i == self .N // 2 :
1236
1236
raise RuntimeError
1237
1237
await barrier .wait ()
1238
- results1 .append (True )
1238
+ results1 .append (True )
1239
1239
except asyncio .BrokenBarrierError :
1240
1240
results2 .append (True )
1241
1241
except RuntimeError :
@@ -1272,7 +1272,7 @@ async def coro():
1272
1272
await barrier2 .wait ()
1273
1273
await barrier .wait ()
1274
1274
results3 .append (True )
1275
-
1275
+
1276
1276
barrier = asyncio .Barrier (self .N )
1277
1277
barrier2 = asyncio .Barrier (self .N )
1278
1278
res , tasks = self .loop .run_until_complete (self .run_coros (self .N , coro ))
0 commit comments