summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/re_tests.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py
index a42857a..adc3a7d 100755
--- a/Lib/test/re_tests.py
+++ b/Lib/test/re_tests.py
@@ -10,21 +10,21 @@
# Benchmark suite (needs expansion)
#
# 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
-# 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.
benchmarks = [
- ('Python', 'Python'), # Simple text literal
- ('.*Python', 'Python'), # Bad text literal
- ('.*Python.*', 'Python'), # Worse text literal
- ('.*(Python)', 'Python'), # Bad text literal with grouping
-
- ('(Python|Perl|Tcl', 'Perl'), # Alternation
- ('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
- ('(Python)\\1', 'PythonPython'), # Backreference
- ('([0a-z][a-z]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization
+ ('Python', 'Python'), # Simple text literal
+ ('.*Python', 'Python'), # Bad text literal
+ ('.*Python.*', 'Python'), # Worse text literal
+ ('.*(Python)', 'Python'), # Bad text literal with grouping
+
+ ('(Python|Perl|Tcl', 'Perl'), # Alternation
+ ('(Python|Perl|Tcl)', 'Perl'), # Grouped alternation
+ ('(Python)\\1', 'PythonPython'), # Backreference
+ ('([0a-z][a-z]*,)+', 'a5,b7,c9,'), # Disable the fastmap optimization
('([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.
-tests = [
+tests = [
# Test ?P< and ?P= extensions
('(?P<foo_123', '', SYNTAX_ERROR), # Unterminated group identifier
('(?P<1>a)', '', SYNTAX_ERROR), # Begins with a digit
@@ -75,7 +75,7 @@ tests = [
(r'[\0a]', '\0', SUCCEED, 'found', '\0'),
(r'[a\0]', '\0', SUCCEED, 'found', '\0'),
(r'[^a\0]', '\0', FAIL),
-
+
# 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'),
@@ -86,9 +86,9 @@ tests = [
(r'\x00f', '\017', SUCCEED, 'found', chr(15)),
(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 \\\\"),
-
+
# Test that . only matches \n in DOTALL mode
('a.b', 'acb', SUCCEED, 'found', 'acb'),
('a.b', 'a\nb', FAIL),
@@ -264,7 +264,7 @@ tests = [
('\\09', chr(0) + '9', SUCCEED, 'found', chr(0) + '9'),
('\\141', 'a', SUCCEED, 'found', 'a'),
('(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\\119', 'abcdefghijklk9', SUCCEED, 'found+"-"+g11', 'abcdefghijklk9-k'),
-
+
# All tests from Perl
('abc', 'abc', SUCCEED, 'found', 'abc'),
@@ -544,13 +544,13 @@ tests = [
# Check odd placement of embedded pattern modifiers
('w(?i)', 'W', SYNTAX_ERROR),
-
+
# Comments using the x embedded pattern modifier
("""(?x)w# comment 1
x y
- # comment 2
- z""", 'wxyz', SUCCEED, 'found', 'wxyz'),
+ # comment 2
+ z""", 'wxyz', SUCCEED, 'found', 'wxyz'),
# using the m embedded pattern modifier
@@ -564,7 +564,7 @@ xyz""", SUCCEED, 'found', 'abc'),
('(?m)abc$', """jkl
xyzabc
123""", SUCCEED, 'found', 'abc'),
-
+
# using the s embedded pattern modifier
('a.b', 'a\nb', FAIL),