diff options
| author | Larry Hastings <larry@hastings.org> | 2014-09-22 14:21:08 (GMT) |
|---|---|---|
| committer | Larry Hastings <larry@hastings.org> | 2014-09-22 14:21:08 (GMT) |
| commit | 2887f76d4512283cf332ca22bef19bc86f4a3147 (patch) | |
| tree | e3cbf66f90a18678e6ce19b9b5c72f1e3d2e9ec1 /Lib/test/test_re.py | |
| parent | f26c2e72d8306b733fe9dad539522a3c04d69798 (diff) | |
| parent | ca2e02cfe68b6d5ddf6cd3f143fe29bd748d0f12 (diff) | |
| download | cpython-2887f76d4512283cf332ca22bef19bc86f4a3147.zip cpython-2887f76d4512283cf332ca22bef19bc86f4a3147.tar.gz cpython-2887f76d4512283cf332ca22bef19bc86f4a3147.tar.bz2 | |
Merge.
Diffstat (limited to 'Lib/test/test_re.py')
| -rw-r--r-- | Lib/test/test_re.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 011fba9..e937c85 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1203,16 +1203,33 @@ class ReTests(unittest.TestCase): self.assertEqual(m.group(2), "y") def test_debug_flag(self): + pat = r'(\.)(?:[ch]|py)(?(1)$|: )' with captured_stdout() as out: - re.compile('foo', re.DEBUG) - self.assertEqual(out.getvalue().splitlines(), - ['literal 102 ', 'literal 111 ', 'literal 111 ']) + re.compile(pat, re.DEBUG) + dump = '''\ +subpattern 1 + literal 46 +subpattern None + branch + in + literal 99 + literal 104 + or + literal 112 + literal 121 +subpattern None + groupref_exists 1 + at at_end + else + literal 58 + literal 32 +''' + self.assertEqual(out.getvalue(), dump) # Debug output is output again even a second time (bypassing # the cache -- issue #20426). with captured_stdout() as out: - re.compile('foo', re.DEBUG) - self.assertEqual(out.getvalue().splitlines(), - ['literal 102 ', 'literal 111 ', 'literal 111 ']) + re.compile(pat, re.DEBUG) + self.assertEqual(out.getvalue(), dump) def test_keyword_parameters(self): # Issue #20283: Accepting the string keyword parameter. |
