diff options
author | Sean Reifschneider <jafo@tummy.com> | 2012-03-13 00:22:38 (GMT) |
---|---|---|
committer | Sean Reifschneider <jafo@tummy.com> | 2012-03-13 00:22:38 (GMT) |
commit | 7b3c975aafc40f09bfd0c39e42153c3a0d086fba (patch) | |
tree | 7c9214b99b13b7c65116b5c72135dfa9332beca0 /Lib/test/test_re.py | |
parent | 45e50de1f5eed5b2ee936e36dd297cd6a43c042d (diff) | |
download | cpython-7b3c975aafc40f09bfd0c39e42153c3a0d086fba.zip cpython-7b3c975aafc40f09bfd0c39e42153c3a0d086fba.tar.gz cpython-7b3c975aafc40f09bfd0c39e42153c3a0d086fba.tar.bz2 |
closes #14259 re.finditer() now takes keyword arguments: pos, endpos.
Contrary to the documentation, finditer() did not take pos and endpos
keyword arguments.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 425c0eb..74a7b71 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -652,6 +652,26 @@ class ReTests(unittest.TestCase): self.assertEqual([item.group(0) for item in iter], [":", "::", ":::"]) + pat = re.compile(r":+") + iter = pat.finditer("a:b::c:::d", 1, 10) + self.assertEqual([item.group(0) for item in iter], + [":", "::", ":::"]) + + pat = re.compile(r":+") + iter = pat.finditer("a:b::c:::d", pos=1, endpos=10) + self.assertEqual([item.group(0) for item in iter], + [":", "::", ":::"]) + + pat = re.compile(r":+") + iter = pat.finditer("a:b::c:::d", endpos=10, pos=1) + self.assertEqual([item.group(0) for item in iter], + [":", "::", ":::"]) + + pat = re.compile(r":+") + iter = pat.finditer("a:b::c:::d", pos=3, endpos=8) + self.assertEqual([item.group(0) for item in iter], + ["::", "::"]) + def test_bug_926075(self): self.assertTrue(re.compile('bug_926075') is not re.compile(b'bug_926075')) |