Exemplo n.º 1
0
    def testFindPinT(self):
        SIZE=1000
        HITS=5
        p, t = makeString(size=SIZE, hits=HITS)
        self.assertEquals(SIZE, len(t))        
        self.assertEquals(HITS, t.count(p))

        hits = list(z.findall(p, t))
        self.assertEquals(HITS, len(hits))

        for hit in hits:
            self.assertEquals(p, t[hit: hit+len(p)])
Exemplo n.º 2
0
 def testFindPinT(self):
     p, t = makeString()
     z_hits = z.findall(p, t)
     brute_hits = bruteforce.findall(p, t)
     for z_hit, brute_hit in itertools.izip(z_hits, brute_hits):
         self.assertEquals(z_hit, brute_hit)