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
a022789a
Kaydet (Commit)
a022789a
authored
Mar 13, 2006
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Plug some refcount leaks when tests are run repeatedly.
üst
abb903fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
16 deletions
+21
-16
test_checkretval.py
Lib/ctypes/test/test_checkretval.py
+6
-6
test_repr.py
Lib/ctypes/test/test_repr.py
+15
-10
No files found.
Lib/ctypes/test/test_checkretval.py
Dosyayı görüntüle @
a022789a
...
...
@@ -3,16 +3,16 @@ import sys
from
ctypes
import
*
class
CHECKED
(
c_int
):
def
_check_retval_
(
value
):
# Receives a CHECKED instance.
return
str
(
value
.
value
)
_check_retval_
=
staticmethod
(
_check_retval_
)
class
Test
(
unittest
.
TestCase
):
def
test_checkretval
(
self
):
class
CHECKED
(
c_int
):
def
_check_retval_
(
value
):
# Receives a CHECKED instance.
return
str
(
value
.
value
)
_check_retval_
=
staticmethod
(
_check_retval_
)
import
_ctypes_test
dll
=
cdll
.
load
(
_ctypes_test
.
__file__
)
self
.
failUnlessEqual
(
42
,
dll
.
_testfunc_p_p
(
42
))
...
...
Lib/ctypes/test/test_repr.py
Dosyayı görüntüle @
a022789a
from
ctypes
import
*
import
unittest
nums
=
[
c_byte
,
c_short
,
c_int
,
c_long
,
c_longlong
,
subclasses
=
[]
for
base
in
[
c_byte
,
c_short
,
c_int
,
c_long
,
c_longlong
,
c_ubyte
,
c_ushort
,
c_uint
,
c_ulong
,
c_ulonglong
,
c_float
,
c_double
]
c_float
,
c_double
]:
class
X
(
base
):
pass
subclasses
.
append
(
X
)
class
X
(
c_char
):
pass
# This test checks if the __repr__ is correct for subclasses of simple types
class
ReprTest
(
unittest
.
TestCase
):
def
test_numbers
(
self
):
for
typ
in
nums
:
self
.
failUnless
(
repr
(
typ
(
42
))
.
startswith
(
typ
.
__name__
))
class
X
(
typ
):
pass
self
.
failUnlessEqual
(
"<X object at"
,
repr
(
X
(
42
))[:
12
])
for
typ
in
subclasses
:
base
=
typ
.
__bases__
[
0
]
self
.
failUnless
(
repr
(
base
(
42
))
.
startswith
(
base
.
__name__
))
self
.
failUnlessEqual
(
"<X object at"
,
repr
(
typ
(
42
))[:
12
])
def
test_char
(
self
):
self
.
failUnlessEqual
(
"c_char('x')"
,
repr
(
c_char
(
'x'
)))
class
X
(
c_char
):
pass
self
.
failUnlessEqual
(
"<X object at"
,
repr
(
X
(
'x'
))[:
12
])
if
__name__
==
"__main__"
:
...
...
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