def test_get_eval_flag_dict_1(self): """Verify 'base' eval dictionary is returned.""" dict = eval_modes.get_eval_flag_dict("base") with self.subTest(): self.assertEqual(len(dict.keys()), 13) with self.subTest(): self.assertTrue(dict["check_locus_tag"])
def test_get_eval_flag_dict_6(self, mock_ask_yes_no): """Verify 'custom' eval dictionary is returned.""" dict = eval_modes.get_eval_flag_dict("custom") with self.subTest(): self.assertEqual(len(dict.keys()), 13) with self.subTest(): self.assertFalse(dict["check_locus_tag"])
def construct_tickets(list_of_data_dict, eval_data_dict, description_field, required_keys, optional_keys, keywords): """Construct pdm_utils ImportTickets from parsed data dictionaries. :param list_of_data_dict: List of import ticket data dictionaries. :type list_of_data_dict: list :param eval_data_dict: Dictionary of boolean evaluation flags. :type eval_data_dict: dict :param description_field: Default value to set ticket.description_field attribute if not present in the data dictionary. :type description_field: str :param required_keys: Set of keys required to be in the data dictionary. :type required_keys: set :param optional_keys: Set of optional keys that are not required to be in the data dictionary. :type optional_keys: set :param keywords: Set of valid keyword values that are handled differently than other values. :type keywords: set :returns: List of pdm_utils ImportTicket objects. :rtype: list """ tkt_id = 0 list_of_tickets = [] for dict in list_of_data_dict: tkt_id += 1 # Each ticket should contain a distinct eval_flag dictionary object. input_eval_mode = eval_data_dict["eval_mode"] input_eval_flag_dict = eval_data_dict["eval_flag_dict"].copy() result = modify_import_data(dict, required_keys, optional_keys, keywords) if result: tkt = parse_import_ticket_data(dict) tkt.id = tkt_id # Only set description_field and eval_mode from parameters # if they weren't set within the ticket. if tkt.description_field == "": tkt.description_field = description_field # Add description_field to data_dict so that it # can be saved to file. tkt.data_dict["description_field"] = description_field if tkt.eval_mode == "": tkt.eval_mode = input_eval_mode tkt.eval_flags = input_eval_flag_dict # Add eval_mode to data_dict so that it can be saved to file. tkt.data_dict["eval_mode"] = input_eval_mode else: if tkt.eval_mode in eval_modes.EVAL_MODES.keys(): tkt.eval_flags = eval_modes.get_eval_flag_dict( tkt.eval_mode) list_of_tickets.append(tkt) else: print("Unable to create ticket.") return list_of_tickets
def test_get_eval_flag_dict_5(self): """Verify 'misc' eval dictionary is returned.""" dict = eval_modes.get_eval_flag_dict("misc") self.assertFalse(dict["check_locus_tag"])
def test_get_eval_flag_dict_3(self): """Verify 'final' eval dictionary is returned.""" dict = eval_modes.get_eval_flag_dict("final") self.assertFalse(dict["import_locus_tag"])
def test_get_eval_flag_dict_4(self): """Verify 'auto' evaluation dictionary is returned.""" dict = eval_modes.get_eval_flag_dict("auto") self.assertFalse(dict["check_locus_tag"])