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

Method check_pattern

Lib/test/string_tests.py:379–388  ·  view source on GitHub ↗
(rr)

Source from the content-addressed store, hash-verified

377 return -1
378
379 def check_pattern(rr):
380 choices = random.choices
381 p0 = ''.join(choices('abcde', k=rr(10))) * rr(10, 20)
382 p = p0[:len(p0) - rr(10)] # pop off some characters
383 left = ''.join(choices('abcdef', k=rr(2000)))
384 right = ''.join(choices('abcdef', k=rr(2000)))
385 text = left + p + right
386 with self.subTest(p=p, text=text):
387 self.checkequal(reference_find(p, text),
388 text, 'find', p)
389
390 rr = random.randrange
391 for _ in range(1000):

Callers

nothing calls this directly

Calls 4

checkequalMethod · 0.95
rrFunction · 0.85
joinMethod · 0.45
subTestMethod · 0.45

Tested by

no test coverage detected