#NEWLINE# def discover_selected_scenarios( self , strict = False ) : #NEWLINE# #INDENT# '\n        Discovers selected scenarios based on the provided file locations.\n        In addition:\n          * discover all scenarios\n          * auto-correct BAD LINE-NUMBERS\n\n        :param strict:  If true, raises exception if file location is invalid.\n        :return: List of selected scenarios of this feature (as set).\n        :raises InvalidFileLocationError:\n            If file location is no exactly correct and strict is true.\n        ' #NEWLINE# assert self . feature #NEWLINE# if ( not self . all_scenarios ) : #NEWLINE# #INDENT# self . all_scenarios = self . feature . walk_scenarios ( ) #NEWLINE# #UNINDENT# existing_lines = [ scenario . line for scenario in self . all_scenarios ] #NEWLINE# selected_lines = list ( self . scenario_lines ) #NEWLINE# for line in selected_lines : #NEWLINE# #INDENT# new_line = self . select_scenario_line_for ( msg , existing_lines ) #NEWLINE# if ( new_line != line ) : #NEWLINE# #INDENT# self . scenario_lines . remove ( line ) #NEWLINE# self . scenario_lines . add ( new_line ) #NEWLINE# if strict : #NEWLINE# #INDENT# msg = ( "Scenario location '...:%d' should be: '%s:%d'" % ( line , self . filename , new_line ) ) #NEWLINE# raise InvalidFileLocationError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# scenario_lines = set ( self . scenario_lines ) #NEWLINE# selected_scenarios = set ( ) #NEWLINE# for scenario in self . all_scenarios : #NEWLINE# #INDENT# if ( scenario . line in scenario_lines ) : #NEWLINE# #INDENT# selected_scenarios . add ( scenario ) #NEWLINE# scenario_lines . remove ( scenario . line ) #NEWLINE# #UNINDENT# #UNINDENT# assert ( not scenario_lines ) #NEWLINE# return selected_scenarios