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
9c0e9c08
Kaydet (Commit)
9c0e9c08
authored
May 26, 2006
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
needspeed: rpartition documentation, tests, and a bug fixes.
feel free to add more tests and improve the documentation.
üst
b3167cbc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
libstdtypes.tex
Doc/lib/libstdtypes.tex
+9
-0
string_tests.py
Lib/test/string_tests.py
+17
-2
unicodeobject.c
Objects/unicodeobject.c
+2
-2
No files found.
Doc/lib/libstdtypes.tex
Dosyayı görüntüle @
9c0e9c08
...
@@ -763,6 +763,15 @@ The original string is returned if
...
@@ -763,6 +763,15 @@ The original string is returned if
\versionchanged
[Support for the \var{fillchar} argument]
{
2.4
}
\versionchanged
[Support for the \var{fillchar} argument]
{
2.4
}
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
[string]
{
rpartition
}{
sep
}
Split the string at the last occurrence of
\var
{
sep
}
, and return
a 3-tuple containing the part before the separator, the separator
itself, and the part after the separator. If the separator is not
found, return a 3-tuple containing the string itself, followed by
two empty strings.
\versionadded
{
2.5
}
\end{methoddesc}
\begin{methoddesc}
[string]
{
rsplit
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
\begin{methoddesc}
[string]
{
rsplit
}{
\optional
{
sep
\optional
{
,maxsplit
}}}
Return a list of the words in the string, using
\var
{
sep
}
as the
Return a list of the words in the string, using
\var
{
sep
}
as the
delimiter string. If
\var
{
maxsplit
}
is given, at most
\var
{
maxsplit
}
delimiter string. If
\var
{
maxsplit
}
is given, at most
\var
{
maxsplit
}
...
...
Lib/test/string_tests.py
Dosyayı görüntüle @
9c0e9c08
...
@@ -999,8 +999,8 @@ class MixinStrUnicodeUserStringTest:
...
@@ -999,8 +999,8 @@ class MixinStrUnicodeUserStringTest:
def
test_partition
(
self
):
def
test_partition
(
self
):
self
.
checkequal
((
'this
'
,
' is '
,
'the parti
tion method'
),
self
.
checkequal
((
'this
is the par'
,
'ti'
,
'
tion method'
),
'this is the partition method'
,
'partition'
,
'
is
'
)
'this is the partition method'
,
'partition'
,
'
ti
'
)
# from raymond's original specification
# from raymond's original specification
S
=
'http://www.python.org'
S
=
'http://www.python.org'
...
@@ -1012,6 +1012,21 @@ class MixinStrUnicodeUserStringTest:
...
@@ -1012,6 +1012,21 @@ class MixinStrUnicodeUserStringTest:
self
.
checkraises
(
ValueError
,
S
,
'partition'
,
''
)
self
.
checkraises
(
ValueError
,
S
,
'partition'
,
''
)
self
.
checkraises
(
TypeError
,
S
,
'partition'
,
None
)
self
.
checkraises
(
TypeError
,
S
,
'partition'
,
None
)
def
test_rpartition
(
self
):
self
.
checkequal
((
'this is the rparti'
,
'ti'
,
'on method'
),
'this is the rpartition method'
,
'rpartition'
,
'ti'
)
# from raymond's original specification
S
=
'http://www.python.org'
self
.
checkequal
((
'http'
,
'://'
,
'www.python.org'
),
S
,
'rpartition'
,
'://'
)
self
.
checkequal
((
'http://www.python.org'
,
''
,
''
),
S
,
'rpartition'
,
'?'
)
self
.
checkequal
((
''
,
'http://'
,
'www.python.org'
),
S
,
'rpartition'
,
'http://'
)
self
.
checkequal
((
'http://www.python.'
,
'org'
,
''
),
S
,
'rpartition'
,
'org'
)
self
.
checkraises
(
ValueError
,
S
,
'rpartition'
,
''
)
self
.
checkraises
(
TypeError
,
S
,
'rpartition'
,
None
)
class
MixinStrStringUserStringTest
:
class
MixinStrStringUserStringTest
:
# Additional tests for 8bit strings, i.e. str, UserString and
# Additional tests for 8bit strings, i.e. str, UserString and
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
9c0e9c08
...
@@ -3861,8 +3861,8 @@ int PyUnicode_EncodeDecimal(Py_UNICODE *s,
...
@@ -3861,8 +3861,8 @@ int PyUnicode_EncodeDecimal(Py_UNICODE *s,
Py_LOCAL
(
int
)
Py_LOCAL
(
int
)
STRINGLIB_CMP
(
const
Py_UNICODE
*
str
,
const
Py_UNICODE
*
other
,
Py_ssize_t
len
)
STRINGLIB_CMP
(
const
Py_UNICODE
*
str
,
const
Py_UNICODE
*
other
,
Py_ssize_t
len
)
{
{
if
(
str
[
0
]
=
=
other
[
0
])
if
(
str
[
0
]
!
=
other
[
0
])
return
0
;
return
1
;
return
memcmp
((
void
*
)
str
,
(
void
*
)
other
,
len
*
sizeof
(
Py_UNICODE
));
return
memcmp
((
void
*
)
str
,
(
void
*
)
other
,
len
*
sizeof
(
Py_UNICODE
));
}
}
...
...
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