diff options
author | Thomas Heller <theller@ctypes.org> | 2007-05-04 19:56:32 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2007-05-04 19:56:32 (GMT) |
commit | 2ebc4d8054615e9e5ad8ef6e35aad6ac419233c8 (patch) | |
tree | 29e7d3deae9cdc10908448b08999015f4ed30b2a /Lib | |
parent | 1ad576c2672aa8d6cae2bf3427fbcd9e75dc564a (diff) | |
download | cpython-2ebc4d8054615e9e5ad8ef6e35aad6ac419233c8.zip cpython-2ebc4d8054615e9e5ad8ef6e35aad6ac419233c8.tar.gz cpython-2ebc4d8054615e9e5ad8ef6e35aad6ac419233c8.tar.bz2 |
Oops, these tests do not run on Windows CE.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/test/test_loading.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py index ee34754..291fcca 100644 --- a/Lib/ctypes/test/test_loading.py +++ b/Lib/ctypes/test/test_loading.py @@ -58,6 +58,22 @@ class LoaderTest(unittest.TestCase): windll.LoadLibrary("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): from _ctypes import LoadLibrary, FreeLibrary # On winXP 64-bit, advapi32 loads at an address that does @@ -85,20 +101,5 @@ class LoaderTest(unittest.TestCase): # This is the real test: call the function via 'call_function' 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__": unittest.main() |