#NEWLINE# def _choose_tagged_tests( tests , tags ) : #NEWLINE# #INDENT# '\n    Select tests that are tagged with at least one of the given tags.\n    ' #NEWLINE# selected = [ ] #NEWLINE# tags = set ( tags ) #NEWLINE# for test in _flatten_suite ( tests ) : #NEWLINE# #INDENT# assert isinstance ( test , unittest . TestCase ) #NEWLINE# func = getattr ( test , test . _testMethodName ) #NEWLINE# try : #NEWLINE# #INDENT# func = func . im_func #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( func . tags & tags ) : #NEWLINE# #INDENT# selected . append ( test ) #NEWLINE# #UNINDENT# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# return unittest . TestSuite ( selected )