diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-25 17:36:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-09-25 17:36:23 (GMT) |
commit | b02f8fc3afe6a8632f8898b990615e51244e23af (patch) | |
tree | fd03da0087983104cfcaf9b5b1c34d25cdb1d1c1 /Lib/test | |
parent | e6f0199c190754cf0da60f98f85e2503109e692d (diff) | |
download | cpython-b02f8fc3afe6a8632f8898b990615e51244e23af.zip cpython-b02f8fc3afe6a8632f8898b990615e51244e23af.tar.gz cpython-b02f8fc3afe6a8632f8898b990615e51244e23af.tar.bz2 |
Issue #11957: Restored re tests for passing count and maxsplit as positional
arguments.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_re.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index f415f3f..0834fe0 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -102,6 +102,8 @@ class ReTests(unittest.TestCase): self.assertEqual(re.sub("(?i)b+", "x", "bbbb BBBB"), 'x x') self.assertEqual(re.sub(r'\d+', self.bump_num, '08.2 -2 23x99y'), '9.3 -3 24x100y') + self.assertEqual(re.sub(r'\d+', self.bump_num, '08.2 -2 23x99y', 3), + '9.3 -3 23x99y') self.assertEqual(re.sub(r'\d+', self.bump_num, '08.2 -2 23x99y', count=3), '9.3 -3 23x99y') @@ -206,6 +208,7 @@ class ReTests(unittest.TestCase): def test_qualified_re_sub(self): self.assertEqual(re.sub('a', 'b', 'aaaaa'), 'bbbbb') + self.assertEqual(re.sub('a', 'b', 'aaaaa', 1), 'baaaa') self.assertEqual(re.sub('a', 'b', 'aaaaa', count=1), 'baaaa') def test_bug_114660(self): @@ -291,6 +294,7 @@ class ReTests(unittest.TestCase): self.assertEqual(re.subn("b+", "x", "bbbb BBBB"), ('x BBBB', 1)) self.assertEqual(re.subn("b+", "x", "xyz"), ('xyz', 0)) self.assertEqual(re.subn("b*", "x", "xyz"), ('xxxyxzx', 4)) + self.assertEqual(re.subn("b*", "x", "xyz", 2), ('xxxyz', 2)) self.assertEqual(re.subn("b*", "x", "xyz", count=2), ('xxxyz', 2)) def test_re_split(self): @@ -347,6 +351,7 @@ class ReTests(unittest.TestCase): self.assertTypedEqual(re.split(sep, ':a:b::c'), expected) def test_qualified_re_split(self): + self.assertEqual(re.split(":", ":a:b::c", 2), ['', 'a', 'b::c']) self.assertEqual(re.split(":", ":a:b::c", maxsplit=2), ['', 'a', 'b::c']) self.assertEqual(re.split(':', 'a:b:c:d', maxsplit=2), ['a', 'b', 'c:d']) self.assertEqual(re.split("(:)", ":a:b::c", maxsplit=2), |