<s> from ctypes import * <EOL> from ctypes . test import is_resource_enabled <EOL> import unittest , sys <EOL> from test import test_support as support <EOL> import _ctypes_test <EOL> if sys . platform == "<STR_LIT:win32>" and sizeof ( c_void_p ) == sizeof ( c_int ) : <EOL> class WindowsTestCase ( unittest . TestCase ) : <EOL> def test_callconv_1 ( self ) : <EOL> IsWindow = windll . user32 . IsWindow <EOL> self . assertRaises ( ValueError , IsWindow ) <EOL> self . assertEqual ( <NUM_LIT:0> , IsWindow ( <NUM_LIT:0> ) ) <EOL> self . assertRaises ( ValueError , IsWindow , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def test_callconv_2 ( self ) : <EOL> IsWindow = cdll . user32 . IsWindow <EOL> self . assertRaises ( ValueError , IsWindow , None ) <EOL> if sys . platform == "<STR_LIT:win32>" : <EOL> class FunctionCallTestCase ( unittest . TestCase ) : <EOL> if is_resource_enabled ( "<STR_LIT>" ) : <EOL> def test_SEH ( self ) : <EOL> self . assertRaises ( WindowsError , windll . kernel32 . GetModuleHandleA , <NUM_LIT:32> ) <EOL> def test_noargs ( self ) : <EOL> windll . user32 . GetDesktopWindow ( ) <EOL> class TestWintypes ( unittest . TestCase ) : <EOL> def test_HWND ( self ) : <EOL> from ctypes import wintypes <EOL> self . assertEqual ( sizeof ( wintypes . HWND ) , sizeof ( c_void_p ) ) <EOL> def test_PARAM ( self ) : <EOL> from ctypes import wintypes <EOL> self . assertEqual ( sizeof ( wintypes . WPARAM ) , <EOL> sizeof ( c_void_p ) ) <EOL> self . assertEqual ( sizeof ( wintypes . LPARAM ) , <EOL> sizeof ( c_void_p ) ) <EOL> def test_COMError ( self ) : <EOL> from _ctypes import COMError <EOL> if support . HAVE_DOCSTRINGS : <EOL> self . assertEqual ( COMError . __doc__ , <EOL> "<STR_LIT>" ) <EOL> ex = COMError ( - <NUM_LIT:1> , "<STR_LIT:text>" , ( "<STR_LIT>" , ) ) <EOL> self . assertEqual ( ex . hresult , - <NUM_LIT:1> ) <EOL> self . assertEqual ( ex . text , "<STR_LIT:text>" ) <EOL> self . assertEqual ( ex . details , ( "<STR_LIT>" , ) ) <EOL> class Structures ( unittest . TestCase ) : <EOL> def test_struct_by_value ( self ) : <EOL> class POINT ( Structure ) : <EOL> _fields_ = [ ( "<STR_LIT:x>" , c_long ) , <EOL> ( "<STR_LIT:y>" , c_long ) ] <EOL> class RECT ( Structure ) : <EOL> _fields_ = [ ( "<STR_LIT:left>" , c_long ) , <EOL> ( "<STR_LIT>" , c_long ) , <EOL> ( "<STR_LIT:right>" , c_long ) , <EOL> ( "<STR_LIT>" , c_long ) ] <EOL> dll = CDLL ( _ctypes_test . __file__ ) <EOL> pt = POINT ( <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> rect = RECT ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:20> , <NUM_LIT:20> ) <EOL> self . assertEqual ( <NUM_LIT:1> , dll . PointInRect ( byref ( rect ) , pt ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
