<s> from ctypes import * <EOL> from ctypes . test import is_resource_enabled <EOL> from support import BaseCTypesTestChecker <EOL> import py <EOL> import sys <EOL> if sys . platform != "<STR_LIT:win32>" : <EOL> py . test . skip ( "<STR_LIT>" ) <EOL> class TestWindows ( BaseCTypesTestChecker ) : <EOL> def test_callconv_1 ( self ) : <EOL> IsWindow = windll . user32 . IsWindow <EOL> py . test . raises ( ValueError , IsWindow ) <EOL> assert IsWindow ( <NUM_LIT:0> ) == <NUM_LIT:0> <EOL> py . test . raises ( ValueError , IsWindow , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> def test_callconv_2 ( self ) : <EOL> IsWindow = cdll . user32 . IsWindow <EOL> py . test . raises ( ValueError , IsWindow , None ) <EOL> if is_resource_enabled ( "<STR_LIT>" ) : <EOL> def test_SEH ( self ) : <EOL> py . test . raises ( WindowsError , windll . kernel32 . GetModuleHandleA , <NUM_LIT:32> ) <EOL> class TestWintypes ( BaseCTypesTestChecker ) : <EOL> def test_COMError ( self ) : <EOL> import _ctypes <EOL> from _ctypes import COMError <EOL> assert COMError . __doc__ == "<STR_LIT>" <EOL> ex = COMError ( - <NUM_LIT:1> , "<STR_LIT:text>" , ( "<STR_LIT>" , ) ) <EOL> assert ex . hresult == - <NUM_LIT:1> <EOL> assert ex . text == "<STR_LIT:text>" <EOL> assert ex . details == ( "<STR_LIT>" , ) <EOL> assert ( ex . hresult , ex . text , ex . details ) == ex [ : ] <EOL> def test_VARIANT ( self ) : <EOL> from ctypes import wintypes <EOL> a = wintypes . VARIANT_BOOL ( ) <EOL> assert a . value is False <EOL> b = wintypes . VARIANT_BOOL ( <NUM_LIT:3> ) <EOL> assert b . value is True <EOL> class TestStructures ( BaseCTypesTestChecker ) : <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> import conftest <EOL> dll = CDLL ( str ( conftest . sofile ) ) <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> assert dll . PointInRect ( byref ( rect ) , pt ) == <NUM_LIT:1> </s>
