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
f5af466d
Kaydet (Commit)
f5af466d
authored
Tem 11, 2007
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix one more ctypes test, and disable the tests that were segfaulting.
Thanks to Christian Heimes for finding these tests.
üst
c92159aa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
test_functions.py
Lib/ctypes/test/test_functions.py
+2
-0
test_python_api.py
Lib/ctypes/test/test_python_api.py
+9
-7
test_slicing.py
Lib/ctypes/test/test_slicing.py
+2
-0
No files found.
Lib/ctypes/test/test_functions.py
Dosyayı görüntüle @
f5af466d
...
@@ -160,6 +160,8 @@ class FunctionTestCase(unittest.TestCase):
...
@@ -160,6 +160,8 @@ class FunctionTestCase(unittest.TestCase):
result
=
f
(
1
,
2
,
3
,
4
,
5.0
,
6.0
,
21
)
result
=
f
(
1
,
2
,
3
,
4
,
5.0
,
6.0
,
21
)
self
.
failUnlessEqual
(
result
,
42
)
self
.
failUnlessEqual
(
result
,
42
)
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_stringresult
(
self
):
def
test_stringresult
(
self
):
f
=
dll
.
_testfunc_p_p
f
=
dll
.
_testfunc_p_p
f
.
argtypes
=
None
f
.
argtypes
=
None
...
...
Lib/ctypes/test/test_python_api.py
Dosyayı görüntüle @
f5af466d
...
@@ -41,17 +41,17 @@ class PythonAPITestCase(unittest.TestCase):
...
@@ -41,17 +41,17 @@ class PythonAPITestCase(unittest.TestCase):
# This test is unreliable, because it is possible that code in
# This test is unreliable, because it is possible that code in
# unittest changes the refcount of the '42' integer. So, it
# unittest changes the refcount of the '42' integer. So, it
# is disabled by default.
# is disabled by default.
def
test_Py
Int
_Long
(
self
):
def
test_Py
Long
_Long
(
self
):
ref42
=
grc
(
42
)
ref42
=
grc
(
42
)
pythonapi
.
Py
Int
_FromLong
.
restype
=
py_object
pythonapi
.
Py
Long
_FromLong
.
restype
=
py_object
self
.
failUnlessEqual
(
pythonapi
.
Py
Int
_FromLong
(
42
),
42
)
self
.
failUnlessEqual
(
pythonapi
.
Py
Long
_FromLong
(
42
),
42
)
self
.
failUnlessEqual
(
grc
(
42
),
ref42
)
self
.
failUnlessEqual
(
grc
(
42
),
ref42
)
pythonapi
.
Py
Int
_AsLong
.
argtypes
=
(
py_object
,)
pythonapi
.
Py
Long
_AsLong
.
argtypes
=
(
py_object
,)
pythonapi
.
Py
Int
_AsLong
.
restype
=
c_long
pythonapi
.
Py
Long
_AsLong
.
restype
=
c_long
res
=
pythonapi
.
Py
Int
_AsLong
(
42
)
res
=
pythonapi
.
Py
Long
_AsLong
(
42
)
self
.
failUnlessEqual
(
grc
(
res
),
ref42
+
1
)
self
.
failUnlessEqual
(
grc
(
res
),
ref42
+
1
)
del
res
del
res
self
.
failUnlessEqual
(
grc
(
42
),
ref42
)
self
.
failUnlessEqual
(
grc
(
42
),
ref42
)
...
@@ -67,6 +67,8 @@ class PythonAPITestCase(unittest.TestCase):
...
@@ -67,6 +67,8 @@ class PythonAPITestCase(unittest.TestCase):
del
pyobj
del
pyobj
self
.
failUnlessEqual
(
grc
(
s
),
ref
)
self
.
failUnlessEqual
(
grc
(
s
),
ref
)
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_PyOS_snprintf
(
self
):
def
test_PyOS_snprintf
(
self
):
PyOS_snprintf
=
pythonapi
.
PyOS_snprintf
PyOS_snprintf
=
pythonapi
.
PyOS_snprintf
PyOS_snprintf
.
argtypes
=
POINTER
(
c_char
),
c_size_t
,
c_char_p
PyOS_snprintf
.
argtypes
=
POINTER
(
c_char
),
c_size_t
,
c_char_p
...
@@ -75,7 +77,7 @@ class PythonAPITestCase(unittest.TestCase):
...
@@ -75,7 +77,7 @@ class PythonAPITestCase(unittest.TestCase):
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from
%
s"
,
"ctypes"
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from
%
s"
,
"ctypes"
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from
%
s
"
,
"ctypes"
,
1
,
2
,
3
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from
%
s (
%
d,
%
d,
%
d)
"
,
"ctypes"
,
1
,
2
,
3
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
# not enough arguments
# not enough arguments
...
...
Lib/ctypes/test/test_slicing.py
Dosyayı görüntüle @
f5af466d
...
@@ -34,6 +34,8 @@ class SlicesTestCase(unittest.TestCase):
...
@@ -34,6 +34,8 @@ class SlicesTestCase(unittest.TestCase):
# ValueError: Can only assign sequence of same size
# ValueError: Can only assign sequence of same size
self
.
assertRaises
(
ValueError
,
setslice
,
a
,
0
,
5
,
range
(
32
))
self
.
assertRaises
(
ValueError
,
setslice
,
a
,
0
,
5
,
range
(
32
))
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_char_ptr
(
self
):
def
test_char_ptr
(
self
):
s
=
"abcdefghijklmnopqrstuvwxyz"
s
=
"abcdefghijklmnopqrstuvwxyz"
...
...
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