MCPcopy Create free account
hub / github.com/davidblewett/rure-python / test_finditer

Method test_finditer

rure/tests/test_regexobject.py:30–39  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

28 self.assertEqual(matches, [u'c', u'z'])
29
30 def test_finditer(self):
31 haystack = u"abc xyz"
32 pattern = rure.compile(u"\\w+(\\w)")
33 gen = pattern.finditer(haystack)
34 match = next(gen)
35 self.assertIsNotNone(match)
36 self.assertEqual(match.captures[0], RureMatch(0, 3))
37 match = next(gen)
38 self.assertIsNotNone(match)
39 self.assertEqual(match.captures[-1], RureMatch(6, 7))
40
41 def test_nonmatching_captures(self):
42 ptn = u"(re).*(ger)"

Callers

nothing calls this directly

Calls 2

compileMethod · 0.80
finditerMethod · 0.80

Tested by

no test coverage detected