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

Method test_find_with_memory

Lib/test/string_tests.py:423–431  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

421 self.checkequal(1, haystack + needle, 'count', needle)
422
423 def test_find_with_memory(self):
424 # Test the "Skip with memory" path in the two-way algorithm.
425 for N in 1000, 3000, 10_000, 30_000:
426 needle = 'ab' * N
427 haystack = ('ab'*(N-1) + 'b') * 2
428 self.checkequal(-1, haystack, 'find', needle)
429 self.checkequal(0, haystack, 'count', needle)
430 self.checkequal(len(haystack), haystack + needle, 'find', needle)
431 self.checkequal(1, haystack + needle, 'count', needle)
432
433 def test_find_shift_table_overflow(self):
434 """When the table of 8-bit shifts overflows."""

Callers

nothing calls this directly

Calls 1

checkequalMethod · 0.95

Tested by

no test coverage detected