MCPcopy Index your code
hub / github.com/python/cpython / test_repr

Method test_repr

Lib/test/lock_tests.py:1240–1265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1238 b.wait()
1239
1240 def test_repr(self):
1241 barrier = self.barriertype(3)
1242 timeout = support.LONG_TIMEOUT
1243 self.assertRegex(repr(barrier), r"<\w+\.Barrier at .*: waiters=0/3>")
1244 def f():
1245 barrier.wait(timeout)
1246
1247 N = 2
1248 with Bunch(f, N):
1249 # Threads blocked on barrier.wait()
1250 for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
1251 if barrier.n_waiting >= N:
1252 break
1253 self.assertRegex(repr(barrier),
1254 r"<\w+\.Barrier at .*: waiters=2/3>")
1255
1256 # Threads unblocked
1257 barrier.wait(timeout)
1258
1259 self.assertRegex(repr(barrier),
1260 r"<\w+\.Barrier at .*: waiters=0/3>")
1261
1262 # Abort the barrier
1263 barrier.abort()
1264 self.assertRegex(repr(barrier),
1265 r"<\w+\.Barrier at .*: broken>")

Callers

nothing calls this directly

Calls 4

assertRegexMethod · 0.80
BunchClass · 0.70
waitMethod · 0.45
abortMethod · 0.45

Tested by

no test coverage detected