MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_pattern

Method check_pattern

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

Source from the content-addressed store, hash-verified

332 return -1
333
334 def check_pattern(rr):
335 choices = random.choices
336 p0 = ''.join(choices('abcde', k=rr(10))) * rr(10, 20)
337 p = p0[:len(p0) - rr(10)] # pop off some characters
338 left = ''.join(choices('abcdef', k=rr(2000)))
339 right = ''.join(choices('abcdef', k=rr(2000)))
340 text = left + p + right
341 with self.subTest(p=p, text=text):
342 self.checkequal(reference_find(p, text),
343 text, 'find', p)
344
345 rr = random.randrange
346 for _ in range(1000):

Callers

nothing calls this directly

Calls 4

checkequalMethod · 0.95
lenFunction · 0.85
subTestMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected