mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
-- whitespace cleanup (real changes coming in next checkin)
This commit is contained in:
parent
1151a8cd61
commit
2643b55a77
1 changed files with 20 additions and 20 deletions
|
@ -10,21 +10,21 @@
|
||||||
# Benchmark suite (needs expansion)
|
# Benchmark suite (needs expansion)
|
||||||
#
|
#
|
||||||
# The benchmark suite does not test correctness, just speed. The
|
# The benchmark suite does not test correctness, just speed. The
|
||||||
# first element of each tuple is the regex pattern; the second is a
|
# first element of each tuple is the regex pattern; the second is a
|
||||||
# string to match it against. The benchmarking code will embed the
|
# string to match it against. The benchmarking code will embed the
|
||||||
# second string inside several sizes of padding, to test how regex
|
# second string inside several sizes of padding, to test how regex
|
||||||
# matching performs on large strings.
|
# matching performs on large strings.
|
||||||
|
|
||||||
benchmarks = [
|
benchmarks = [
|
||||||
('Python', 'Python'), # Simple text literal
|
('Python', 'Python'), # Simple text literal
|
||||||
('.*Python', 'Python'), # Bad text literal
|
('.*Python', 'Python'), # Bad text literal
|
||||||
('.*Python.*', 'Python'), # Worse text literal
|
('.*Python.*', 'Python'), # Worse text literal
|
||||||
('.*(Python)', 'Python'), # Bad text literal with grouping
|
('.*(Python)', 'Python'), # Bad text literal with grouping
|
||||||
|
|
||||||
('(Python|Perl|Tcl', 'Perl'), # Alternation
|
('(Python|Perl|Tcl', 'Perl'), # Alternation
|
||||||
('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
|
('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
|
||||||
('(Python)\\1', 'PythonPython'), # Backreference
|
('(Python)\\1', 'PythonPython'), # Backreference
|
||||||
('([0a-z][a-z]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization
|
('([0a-z][a-z]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization
|
||||||
('([a-z][a-z0-9]*,)+', 'a5,b7,c9,') # A few sets
|
('([a-z][a-z0-9]*,)+', 'a5,b7,c9,') # A few sets
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ benchmarks = [
|
||||||
#
|
#
|
||||||
# If the regex isn't expected to work, the latter two elements can be omitted.
|
# If the regex isn't expected to work, the latter two elements can be omitted.
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
# Test ?P< and ?P= extensions
|
# Test ?P< and ?P= extensions
|
||||||
('(?P<foo_123', '', SYNTAX_ERROR), # Unterminated group identifier
|
('(?P<foo_123', '', SYNTAX_ERROR), # Unterminated group identifier
|
||||||
('(?P<1>a)', '', SYNTAX_ERROR), # Begins with a digit
|
('(?P<1>a)', '', SYNTAX_ERROR), # Begins with a digit
|
||||||
|
@ -75,7 +75,7 @@ tests = [
|
||||||
(r'[\0a]', '\0', SUCCEED, 'found', '\0'),
|
(r'[\0a]', '\0', SUCCEED, 'found', '\0'),
|
||||||
(r'[a\0]', '\0', SUCCEED, 'found', '\0'),
|
(r'[a\0]', '\0', SUCCEED, 'found', '\0'),
|
||||||
(r'[^a\0]', '\0', FAIL),
|
(r'[^a\0]', '\0', FAIL),
|
||||||
|
|
||||||
# Test various letter escapes
|
# Test various letter escapes
|
||||||
(r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
|
(r'\a[\b]\f\n\r\t\v', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
|
||||||
(r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
|
(r'[\a][\b][\f][\n][\r][\t][\v]', '\a\b\f\n\r\t\v', SUCCEED, 'found', '\a\b\f\n\r\t\v'),
|
||||||
|
@ -86,9 +86,9 @@ tests = [
|
||||||
(r'\x00f', '\017', SUCCEED, 'found', chr(15)),
|
(r'\x00f', '\017', SUCCEED, 'found', chr(15)),
|
||||||
(r'\x00fe', '\376', SUCCEED, 'found', chr(254)),
|
(r'\x00fe', '\376', SUCCEED, 'found', chr(254)),
|
||||||
|
|
||||||
(r"^\w+=(\\[\000-\277]|[^\n\\])*", "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c",
|
(r"^\w+=(\\[\000-\277]|[^\n\\])*", "SRC=eval.c g.c blah blah blah \\\\\n\tapes.c",
|
||||||
SUCCEED, 'found', "SRC=eval.c g.c blah blah blah \\\\"),
|
SUCCEED, 'found', "SRC=eval.c g.c blah blah blah \\\\"),
|
||||||
|
|
||||||
# Test that . only matches \n in DOTALL mode
|
# Test that . only matches \n in DOTALL mode
|
||||||
('a.b', 'acb', SUCCEED, 'found', 'acb'),
|
('a.b', 'acb', SUCCEED, 'found', 'acb'),
|
||||||
('a.b', 'a\nb', FAIL),
|
('a.b', 'a\nb', FAIL),
|
||||||
|
@ -264,7 +264,7 @@ tests = [
|
||||||
('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
|
('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
|
||||||
('\\141', 'a', SUCCEED, 'found', 'a'),
|
('\\141', 'a', SUCCEED, 'found', 'a'),
|
||||||
('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
|
('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
|
||||||
|
|
||||||
# All tests from Perl
|
# All tests from Perl
|
||||||
|
|
||||||
('abc', 'abc', SUCCEED, 'found', 'abc'),
|
('abc', 'abc', SUCCEED, 'found', 'abc'),
|
||||||
|
@ -544,13 +544,13 @@ tests = [
|
||||||
# Check odd placement of embedded pattern modifiers
|
# Check odd placement of embedded pattern modifiers
|
||||||
|
|
||||||
('w(?i)', 'W', SYNTAX_ERROR),
|
('w(?i)', 'W', SYNTAX_ERROR),
|
||||||
|
|
||||||
# Comments using the x embedded pattern modifier
|
# Comments using the x embedded pattern modifier
|
||||||
|
|
||||||
("""(?x)w# comment 1
|
("""(?x)w# comment 1
|
||||||
x y
|
x y
|
||||||
# comment 2
|
# comment 2
|
||||||
z""", 'wxyz', SUCCEED, 'found', 'wxyz'),
|
z""", 'wxyz', SUCCEED, 'found', 'wxyz'),
|
||||||
|
|
||||||
# using the m embedded pattern modifier
|
# using the m embedded pattern modifier
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ xyz""", SUCCEED, 'found', 'abc'),
|
||||||
('(?m)abc$', """jkl
|
('(?m)abc$', """jkl
|
||||||
xyzabc
|
xyzabc
|
||||||
123""", SUCCEED, 'found', 'abc'),
|
123""", SUCCEED, 'found', 'abc'),
|
||||||
|
|
||||||
# using the s embedded pattern modifier
|
# using the s embedded pattern modifier
|
||||||
|
|
||||||
('a.b', 'a\nb', FAIL),
|
('a.b', 'a\nb', FAIL),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue