def get_current_opt_parent_topmenu(self): """ Return the current option's first menu position or Return False if no option is selected""" if self.has_option_selected() is False: return False return utility.get_index_menu_option(self.cursor, self.items, self.top_menus)
def test_get_index_menu_option(self): """ Returns the index of the top menu where there is an option Returns 0 if the option is not in a menu Returns a number between 1 and the number of top menus """ for i in range(len(items) - 1): index = utility.get_index_menu_option(i, items, top_menus) self.assertTrue(index >= 0) self.assertTrue(index <= len(top_menus))