#NEWLINE# def _expand_test_methods( test_cls ) : #NEWLINE# #INDENT# attr_names = dir ( test_cls ) #NEWLINE# seen_names = set ( attr_names ) #NEWLINE# attrs_to_substitute = dict ( ) #NEWLINE# attrs_to_add = dict ( ) #NEWLINE# for base_name in attr_names : #NEWLINE# #INDENT# obj = getattr ( test_cls , base_name , None ) #NEWLINE# paramseq_objs = getattr ( obj , _PARAMSEQ_OBJS_ATTR , None ) #NEWLINE# if ( paramseq_objs is not None ) : #NEWLINE# #INDENT# if _PY3 : #NEWLINE# #INDENT# if ( not isinstance ( obj , types . FunctionType ) ) : #NEWLINE# #INDENT# raise TypeError ( '{0!r} is not a function' . format ( obj ) ) #NEWLINE# #UNINDENT# base_func = obj #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( obj , types . MethodType ) ) : #NEWLINE# #INDENT# raise TypeError ( '{0!r} is not a method' . format ( obj ) ) #NEWLINE# #UNINDENT# base_func = obj . __func__ #NEWLINE# #UNINDENT# arg_spec = inspect . getargspec ( base_func ) #NEWLINE# accepted_generic_kwargs = set ( ( _GENERIC_KWARGS if ( arg_spec . keywords is not None ) else ( kw for kw in _GENERIC_KWARGS if ( kw in arg_spec . args ) ) ) ) #NEWLINE# for func in _generate_parametrized_functions ( test_cls , paramseq_objs , base_name , base_func , seen_names , accepted_generic_kwargs ) : #NEWLINE# #INDENT# attrs_to_add [ func . __name__ ] = func #NEWLINE# #UNINDENT# attrs_to_substitute [ base_name ] = obj #NEWLINE# #UNINDENT# #UNINDENT# for ( name , obj ) in attrs_to_substitute . items ( ) : #NEWLINE# #INDENT# setattr ( test_cls , name , Substitute ( obj ) ) #NEWLINE# #UNINDENT# for ( name , obj ) in attrs_to_add . items ( ) : #NEWLINE# #INDENT# setattr ( test_cls , name , obj )