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
2ebc4d80
Kaydet (Commit)
2ebc4d80
authored
May 04, 2007
tarafından
Thomas Heller
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Oops, these tests do not run on Windows CE.
üst
1ad576c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
test_loading.py
Lib/ctypes/test/test_loading.py
+16
-15
No files found.
Lib/ctypes/test/test_loading.py
Dosyayı görüntüle @
2ebc4d80
...
@@ -58,6 +58,22 @@ class LoaderTest(unittest.TestCase):
...
@@ -58,6 +58,22 @@ class LoaderTest(unittest.TestCase):
windll
.
LoadLibrary
(
"coredll"
)
.
GetModuleHandleW
windll
.
LoadLibrary
(
"coredll"
)
.
GetModuleHandleW
WinDLL
(
"coredll"
)
.
GetModuleHandleW
WinDLL
(
"coredll"
)
.
GetModuleHandleW
def
test_load_ordinal_functions
(
self
):
import
_ctypes_test
dll
=
WinDLL
(
_ctypes_test
.
__file__
)
# We load the same function both via ordinal and name
func_ord
=
dll
[
2
]
func_name
=
dll
.
GetString
# addressof gets the address where the function pointer is stored
a_ord
=
addressof
(
func_ord
)
a_name
=
addressof
(
func_name
)
f_ord_addr
=
c_void_p
.
from_address
(
a_ord
)
.
value
f_name_addr
=
c_void_p
.
from_address
(
a_name
)
.
value
self
.
failUnlessEqual
(
hex
(
f_ord_addr
),
hex
(
f_name_addr
))
self
.
failUnlessRaises
(
AttributeError
,
dll
.
__getitem__
,
1234
)
if
os
.
name
==
"nt"
:
def
test_1703286_A
(
self
):
def
test_1703286_A
(
self
):
from
_ctypes
import
LoadLibrary
,
FreeLibrary
from
_ctypes
import
LoadLibrary
,
FreeLibrary
# On winXP 64-bit, advapi32 loads at an address that does
# On winXP 64-bit, advapi32 loads at an address that does
...
@@ -85,20 +101,5 @@ class LoaderTest(unittest.TestCase):
...
@@ -85,20 +101,5 @@ class LoaderTest(unittest.TestCase):
# This is the real test: call the function via 'call_function'
# This is the real test: call the function via 'call_function'
self
.
failUnlessEqual
(
0
,
call_function
(
proc
,
(
None
,)))
self
.
failUnlessEqual
(
0
,
call_function
(
proc
,
(
None
,)))
def
test_load_ordinal_functions
(
self
):
import
_ctypes_test
dll
=
WinDLL
(
_ctypes_test
.
__file__
)
# We load the same function both via ordinal and name
func_ord
=
dll
[
2
]
func_name
=
dll
.
GetString
# addressof gets the address where the function pointer is stored
a_ord
=
addressof
(
func_ord
)
a_name
=
addressof
(
func_name
)
f_ord_addr
=
c_void_p
.
from_address
(
a_ord
)
.
value
f_name_addr
=
c_void_p
.
from_address
(
a_name
)
.
value
self
.
failUnlessEqual
(
hex
(
f_ord_addr
),
hex
(
f_name_addr
))
self
.
failUnlessRaises
(
AttributeError
,
dll
.
__getitem__
,
1234
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
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