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
b7747e2a
Kaydet (Commit)
b7747e2a
authored
Eki 28, 2001
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added finditer sanity check
üst
ca6dfa55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
sre.py
Lib/sre.py
+2
-3
test_sre.py
Lib/test/test_sre.py
+11
-0
No files found.
Lib/sre.py
Dosyayı görüntüle @
b7747e2a
...
...
@@ -167,9 +167,8 @@ def findall(pattern, string):
if
sys
.
hexversion
>=
0x02020000
:
def
finditer
(
pattern
,
string
):
"""Return an iterator over all non-overlapping matches in
the string. For each match, the iterator returns a match
object.
"""Return an iterator over all non-overlapping matches in the
string. For each match, the iterator returns a match object.
Empty matches are included in the result."""
return
_compile
(
pattern
,
0
)
.
finditer
(
string
)
...
...
Lib/test/test_sre.py
Dosyayı görüntüle @
b7747e2a
...
...
@@ -184,6 +184,17 @@ test(r"""sre.findall(r"(a)|(b)", "abc")""", [("a", ""), ("", "b")])
# bug 117612
test
(
r"""sre.findall(r"(a|(b))", "aba")"""
,
[(
"a"
,
""
),(
"b"
,
"b"
),(
"a"
,
""
)])
if
sys
.
hexversion
>=
0x02020000
:
if
verbose
:
print
"Running tests on sre.finditer"
def
fixup
(
seq
):
# convert iterator to list
if
not
hasattr
(
seq
,
"next"
)
or
not
hasattr
(
seq
,
"__iter__"
):
print
"finditer returned"
,
type
(
seq
)
return
map
(
lambda
item
:
item
.
group
(
0
),
seq
)
# sanity
test
(
r"""fixup(sre.finditer(r":+", "a:b::c:::d"))"""
,
[
":"
,
"::"
,
":::"
])
if
verbose
:
print
"Running tests on sre.match"
...
...
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