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
847ed4af
Kaydet (Commit)
847ed4af
authored
Tem 15, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More tweaks; re.py is nearly there...
üst
53109750
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
13 deletions
+5
-13
test_re
Lib/test/output/test_re
+1
-8
re_tests.py
Lib/test/re_tests.py
+1
-1
test_re.py
Lib/test/test_re.py
+3
-4
No files found.
Lib/test/output/test_re
Dosyayı görüntüle @
847ed4af
...
@@ -34,7 +34,6 @@ test_re
...
@@ -34,7 +34,6 @@ test_re
('a[b-d]e', 'ace', 0, 'found', 'ace')
('a[b-d]e', 'ace', 0, 'found', 'ace')
('a[b-d]', 'aac', 0, 'found', 'ac')
('a[b-d]', 'aac', 0, 'found', 'ac')
('a[-b]', 'a-', 0, 'found', 'a-')
('a[-b]', 'a-', 0, 'found', 'a-')
=== Syntax error: ('a[-b]', 'a-', 0, 'found', 'a-')
('a[b-]', 'a-', 2)
('a[b-]', 'a-', 2)
('a[]b', '-', 2)
('a[]b', '-', 2)
('a[', '-', 2)
('a[', '-', 2)
...
@@ -43,16 +42,12 @@ test_re
...
@@ -43,16 +42,12 @@ test_re
('(abc', '-', 2)
('(abc', '-', 2)
('a]', 'a]', 0, 'found', 'a]')
('a]', 'a]', 0, 'found', 'a]')
('a[]]b', 'a]b', 0, 'found', 'a]b')
('a[]]b', 'a]b', 0, 'found', 'a]b')
=== Syntax error: ('a[]]b', 'a]b', 0, 'found', 'a]b')
('a[^bc]d', 'aed', 0, 'found', 'aed')
('a[^bc]d', 'aed', 0, 'found', 'aed')
('a[^bc]d', 'abd', 1)
('a[^bc]d', 'abd', 1)
('a[^-b]c', 'adc', 0, 'found', 'adc')
('a[^-b]c', 'adc', 0, 'found', 'adc')
=== Syntax error: ('a[^-b]c', 'adc', 0, 'found', 'adc')
('a[^-b]c', 'a-c', 1)
('a[^-b]c', 'a-c', 1)
=== Syntax error: ('a[^-b]c', 'a-c', 1)
('a[^]b]c', 'a]c', 1)
('a[^]b]c', 'a]c', 1)
('a[^]b]c', 'adc', 0, 'found', 'adc')
('a[^]b]c', 'adc', 0, 'found', 'adc')
=== Failed incorrectly ('a[^]b]c', 'adc', 0, 'found', 'adc')
('\\ba\\b', 'a-', 0, '"-"', '-')
('\\ba\\b', 'a-', 0, '"-"', '-')
('\\ba\\b', '-a', 0, '"-"', '-')
('\\ba\\b', '-a', 0, '"-"', '-')
('\\ba\\b', '-a-', 0, '"-"', '-')
('\\ba\\b', '-a-', 0, '"-"', '-')
...
@@ -64,8 +59,7 @@ test_re
...
@@ -64,8 +59,7 @@ test_re
('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
=== Syntax error: ('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
=== Syntax error: ('()ef', 'def', 0, 'found+"-"+g1', 'ef-')
('$b', 'b', 1)
('$b', 'b', 1)
('a(b', 'a(b', 0, 'found+"-"+g1', 'a(b-None')
('a\\(b', 'a(b', 0, 'found+"-"+g1', 'a(b-None')
=== Syntax error: ('a(b', 'a(b', 0, 'found+"-"+g1', 'a(b-None')
('a\\(*b', 'ab', 0, 'found', 'ab')
('a\\(*b', 'ab', 0, 'found', 'ab')
('a\\(*b', 'a((b', 0, 'found', 'a((b')
('a\\(*b', 'a((b', 0, 'found', 'a((b')
('a\\\\b', 'a\\b', 0, 'found', 'a\\b')
('a\\\\b', 'a\\b', 0, 'found', 'a\\b')
...
@@ -113,7 +107,6 @@ test_re
...
@@ -113,7 +107,6 @@ test_re
('\\((.*), (.*)\\)', '(a, b)', 0, 'g2+"-"+g1', 'b-a')
('\\((.*), (.*)\\)', '(a, b)', 0, 'g2+"-"+g1', 'b-a')
('[k]', 'ab', 1)
('[k]', 'ab', 1)
('a[-]?c', 'ac', 0, 'found', 'ac')
('a[-]?c', 'ac', 0, 'found', 'ac')
=== Syntax error: ('a[-]?c', 'ac', 0, 'found', 'ac')
('(abc)\\1', 'abcabc', 0, 'g1', 'abc')
('(abc)\\1', 'abcabc', 0, 'g1', 'abc')
('([a-c]*)\\1', 'abcabc', 0, 'g1', 'abc')
('([a-c]*)\\1', 'abcabc', 0, 'g1', 'abc')
('^(.+)?B', 'AB', 0, 'g1', 'A')
('^(.+)?B', 'AB', 0, 'g1', 'A')
...
...
Lib/test/re_tests.py
Dosyayı görüntüle @
847ed4af
...
@@ -136,7 +136,7 @@ tests = [
...
@@ -136,7 +136,7 @@ tests = [
(
'()ef'
,
'def'
,
SUCCEED
,
(
'()ef'
,
'def'
,
SUCCEED
,
'found+"-"+g1'
,
'ef-'
),
'found+"-"+g1'
,
'ef-'
),
(
'$b'
,
'b'
,
FAIL
),
(
'$b'
,
'b'
,
FAIL
),
(
'a(b'
,
'a(b'
,
SUCCEED
,
(
'a
\\
(b'
,
'a(b'
,
SUCCEED
,
'found+"-"+g1'
,
'a(b-None'
),
'found+"-"+g1'
,
'a(b-None'
),
(
'a
\\
(*b'
,
'ab'
,
SUCCEED
,
(
'a
\\
(*b'
,
'ab'
,
SUCCEED
,
'found'
,
'ab'
),
'found'
,
'ab'
),
...
...
Lib/test/test_re.py
Dosyayı görüntüle @
847ed4af
...
@@ -41,16 +41,15 @@ for t in tests:
...
@@ -41,16 +41,15 @@ for t in tests:
# Matched, as expected, so now we compute the
# Matched, as expected, so now we compute the
# result string and compare it to our expected result.
# result string and compare it to our expected result.
start
,
end
=
result
.
span
(
0
)
start
,
end
=
result
.
span
(
0
)
vardict
=
{
'found'
:
result
.
group
(
0
)}
vardict
=
{
'found'
:
result
.
group
(
0
)
,
'groups'
:
result
.
group
()
}
for
i
in
range
(
1
,
100
):
for
i
in
range
(
1
,
100
):
try
:
try
:
gi
=
result
.
group
(
i
)
gi
=
result
.
group
(
i
)
# Special hack because else the string concat fails:
# Special hack because else the string concat fails:
if
gi
is
None
:
gi
=
"None"
if
gi
is
None
:
gi
=
"None"
except
IndexError
:
except
IndexError
:
break
gi
=
"None"
else
:
vardict
[
'g
%
d'
%
i
]
=
gi
vardict
[
'g
%
d'
%
i
]
=
gi
repl
=
eval
(
repl
,
vardict
)
repl
=
eval
(
repl
,
vardict
)
if
repl
!=
expected
:
if
repl
!=
expected
:
print
'=== grouping error'
,
t
,
print
'=== grouping error'
,
t
,
...
...
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