(self)
| 395 | check_pattern(lambda *args: 0) |
| 396 | |
| 397 | def test_find_many_lengths(self): |
| 398 | haystack_repeats = [a * 10**e for e in range(6) for a in (1,2,5)] |
| 399 | haystacks = [(n, self.fixtype("abcab"*n + "da")) for n in haystack_repeats] |
| 400 | |
| 401 | needle_repeats = [a * 10**e for e in range(6) for a in (1, 3)] |
| 402 | needles = [(m, self.fixtype("abcab"*m + "da")) for m in needle_repeats] |
| 403 | |
| 404 | for n, haystack1 in haystacks: |
| 405 | haystack2 = haystack1[:-1] |
| 406 | for m, needle in needles: |
| 407 | answer1 = 5 * (n - m) if m <= n else -1 |
| 408 | self.assertEqual(haystack1.find(needle), answer1, msg=(n,m)) |
| 409 | self.assertEqual(haystack2.find(needle), -1, msg=(n,m)) |
| 410 | |
| 411 | def test_adaptive_find(self): |
| 412 | # This would be very slow for the naive algorithm, |
nothing calls this directly
no test coverage detected