def test_find(self):
        patterns = ('at', 'gag', 'gc', 'gata')
        text = 'tatatattgcgccatattagagattagatagga'
        result = set()
        for pattern in patterns:
            occurrences = naive_find(pattern, text)
            result |= set(((o, pattern) for o in occurrences))

        self.assertSetEqual(result, set(aho_corrasick(patterns, text)))
 def test_small(self):
     patterns = ('at', 'gag', 'gc', 'gata')
     text = 'tatatattgcgccatattagagattagatagga'
     for pattern in patterns:
         self.assertListEqual(kmp(pattern, text), naive_find(pattern, text))
 def test_find(self):
     text = 'tatatattgcgccatattagagattagatagga'
     self.assertListEqual(naive_find('at', text), [1, 3, 5, 13, 15, 22, 27])
     self.assertListEqual(naive_find('gag', text), [19])
     self.assertListEqual(naive_find('gc', text), [8, 10])
     self.assertListEqual(naive_find('gata', text), [26])
 def test_not_find(self):
     text = 'tatatattgcgccatattagagattagatagga'
     self.assertListEqual(naive_find('alt', text), [])
 def test_small2(self):
     text = 'ctaataatg'
     t = sa_preprocess(text)
     self.assertListEqual(suffix_array_match('taa', t, sort=True), naive_find('taa', text))
 def test_small(self):
     patterns = ('at', 'gag', 'gc', 'gata')
     text = 'tatatattgcgccatattagagattagatagga'
     t = sa_preprocess(text)
     for pattern in patterns:
         self.assertListEqual(suffix_array_match(pattern, t, sort=True), naive_find(pattern, text))