<s> import unittest <EOL> from ctypes import * <EOL> from ctypes . test import need_symbol <EOL> class CHECKED ( c_int ) : <EOL> def _check_retval_ ( value ) : <EOL> return str ( value . value ) <EOL> _check_retval_ = staticmethod ( _check_retval_ ) <EOL> class Test ( unittest . TestCase ) : <EOL> def test_checkretval ( self ) : <EOL> import _ctypes_test <EOL> dll = CDLL ( _ctypes_test . __file__ ) <EOL> self . assertEqual ( <NUM_LIT> , dll . _testfunc_p_p ( <NUM_LIT> ) ) <EOL> dll . _testfunc_p_p . restype = CHECKED <EOL> self . assertEqual ( "<STR_LIT>" , dll . _testfunc_p_p ( <NUM_LIT> ) ) <EOL> dll . _testfunc_p_p . restype = None <EOL> self . assertEqual ( None , dll . _testfunc_p_p ( <NUM_LIT> ) ) <EOL> del dll . _testfunc_p_p . restype <EOL> self . assertEqual ( <NUM_LIT> , dll . _testfunc_p_p ( <NUM_LIT> ) ) <EOL> @ need_symbol ( '<STR_LIT>' ) <EOL> def test_oledll ( self ) : <EOL> self . assertRaises ( WindowsError , <EOL> oledll . oleaut32 . CreateTypeLib2 , <EOL> <NUM_LIT:0> , None , None ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
