diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-21 19:47:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-21 19:47:55 (GMT) |
commit | 44dae8bde36866c2e216991498a3a3f883b3c8f2 (patch) | |
tree | 11078d6682845fefd2a493762f509c18a14b77e2 /Lib/test | |
parent | 1a5426dbaf71d8b414abfc781fecb696c2d751dc (diff) | |
download | cpython-44dae8bde36866c2e216991498a3a3f883b3c8f2.zip cpython-44dae8bde36866c2e216991498a3a3f883b3c8f2.tar.gz cpython-44dae8bde36866c2e216991498a3a3f883b3c8f2.tar.bz2 |
Issue #22423: Fixed debugging output of the GROUPREF_EXISTS opcode in the re
module.
Diffstat (limited to 'Lib/test')
-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. |