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
e511fc79
Kaydet (Commit)
e511fc79
authored
Şub 16, 2010
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#7930: fix stripid
üst
6dfe6629
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
pydoc.py
Lib/pydoc.py
+1
-3
test_pydoc.py
Lib/test/test_pydoc.py
+13
-0
No files found.
Lib/pydoc.py
Dosyayı görüntüle @
e511fc79
...
@@ -124,9 +124,7 @@ _re_stripid = re.compile(r' at 0x[0-9a-f]{6,16}(>+)$', re.IGNORECASE)
...
@@ -124,9 +124,7 @@ _re_stripid = re.compile(r' at 0x[0-9a-f]{6,16}(>+)$', re.IGNORECASE)
def
stripid
(
text
):
def
stripid
(
text
):
"""Remove the hexadecimal id from a Python object representation."""
"""Remove the hexadecimal id from a Python object representation."""
# The behaviour of %p is implementation-dependent in terms of case.
# The behaviour of %p is implementation-dependent in terms of case.
if
_re_stripid
.
search
(
repr
(
Exception
)):
return
_re_stripid
.
sub
(
r'\1'
,
text
)
return
_re_stripid
.
sub
(
r'\1'
,
text
)
return
text
def
_is_some_method
(
obj
):
def
_is_some_method
(
obj
):
return
inspect
.
ismethod
(
obj
)
or
inspect
.
ismethoddescriptor
(
obj
)
return
inspect
.
ismethod
(
obj
)
or
inspect
.
ismethoddescriptor
(
obj
)
...
...
Lib/test/test_pydoc.py
Dosyayı görüntüle @
e511fc79
...
@@ -291,6 +291,19 @@ class PyDocDocTest(unittest.TestCase):
...
@@ -291,6 +291,19 @@ class PyDocDocTest(unittest.TestCase):
"white space was not stripped from module name "
"white space was not stripped from module name "
"or other error output mismatch"
)
"or other error output mismatch"
)
def
test_stripid
(
self
):
# test with strings, other implementations might have different repr()
stripid
=
pydoc
.
stripid
# strip the id
self
.
assertEqual
(
stripid
(
'<function stripid at 0x88dcee4>'
),
'<function stripid>'
)
self
.
assertEqual
(
stripid
(
'<function stripid at 0x01F65390>'
),
'<function stripid>'
)
# nothing to strip, return the same text
self
.
assertEqual
(
stripid
(
'42'
),
'42'
)
self
.
assertEqual
(
stripid
(
"<type 'exceptions.Exception'>"
),
"<type 'exceptions.Exception'>"
)
class
TestDescriptions
(
unittest
.
TestCase
):
class
TestDescriptions
(
unittest
.
TestCase
):
...
...
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