(self)
| 350 | check_pattern(lambda *args: 0) |
| 351 | |
| 352 | def test_find_many_lengths(self): |
| 353 | haystack_repeats = [a * 10**e for e in range(6) for a in (1,2,5)] |
| 354 | haystacks = [(n, self.fixtype("abcab"*n + "da")) for n in haystack_repeats] |
| 355 | |
| 356 | needle_repeats = [a * 10**e for e in range(6) for a in (1, 3)] |
| 357 | needles = [(m, self.fixtype("abcab"*m + "da")) for m in needle_repeats] |
| 358 | |
| 359 | for n, haystack1 in haystacks: |
| 360 | haystack2 = haystack1[:-1] |
| 361 | for m, needle in needles: |
| 362 | answer1 = 5 * (n - m) if m <= n else -1 |
| 363 | self.assertEqual(haystack1.find(needle), answer1, msg=(n,m)) |
| 364 | self.assertEqual(haystack2.find(needle), -1, msg=(n,m)) |
| 365 | |
| 366 | def test_adaptive_find(self): |
| 367 | # This would be very slow for the naive algorithm, |
nothing calls this directly
no test coverage detected