Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
2643b55a
Kaydet (Commit)
2643b55a
authored
Agu 08, 2000
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
-- whitespace cleanup (real changes coming in next checkin)
üst
1151a8cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
re_tests.py
Lib/test/re_tests.py
+20
-20
No files found.
Lib/test/re_tests.py
Dosyayı görüntüle @
2643b55a
...
...
@@ -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\t
apes.c"
,
(
r"^\w+=(\\[\000-\277]|[^\n\\])*"
,
"SRC=eval.c g.c blah blah blah
\\\\\n\t
apes.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
\n
b'
,
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
\n
b'
,
FAIL
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment