def get_eval_flag_dict(eval_mode): """Get a dictionary of evaluation flags. :param eval_mode: Valid evaluation mode (base, draft, final, auto, misc, custom) :type eval_mode: str :returns: Dictionary of boolean values. :rtype: dict """ # Base dictionary with all flags set to True. dict = {} for key in EVAL_FLAGS: dict[key] = True # Auto-annotations. if eval_mode == "draft": dict["check_locus_tag"] = False dict["check_trna"] = False dict["import_locus_tag"] = False dict["check_id_typo"] = False dict["check_host_typo"] = False dict["check_author"] = False dict["check_description"] = False dict["check_coords"] = False # Manual annotations. elif eval_mode == "final": dict["import_locus_tag"] = False # SEA-PHAGES GenBank records. elif eval_mode == "auto": dict["check_locus_tag"] = False dict["check_description_field"] = False dict["check_replace"] = False dict["check_trna"] = False dict["check_id_typo"] = False dict["check_host_typo"] = False dict["check_author"] = False dict["check_description"] = False dict["check_description_tally"] = False dict["check_gene"] = False dict["check_coords"] = False # Non-SEA-PHAGES GenBank records. elif eval_mode == "misc": dict["check_locus_tag"] = False # TODO below should probably be True, but it causes problems # when checking the current genome, GNM2_001, since these are not 'draft' # genomes. dict["check_replace"] = False dict["check_trna"] = False dict["check_id_typo"] = False dict["check_host_typo"] = False dict["check_author"] = False dict["check_description"] = False dict["check_description_tally"] = False dict["check_gene"] = False # Custom QC settings. User can select the settings, so it is initialized as # a copy of the base eval_mode. The user can provide the # customized combination of options. elif eval_mode == "custom": for key in dict.keys(): prompt = f"Eval_flag: {key}. {EVAL_FLAGS[key]}" response = basic.ask_yes_no(prompt=prompt, response_attempt=3) if response is None: print("The default setting for this eval_flag will be used.") else: dict[key] = response elif eval_mode == "base": pass else: print("A valid eval_mode has not been selected.") return dict
def test_ask_yes_no_5(self, input_mock): """Verify output when attempts = 3 and user provides valid response on last attempt.""" input_mock.side_effect = ["invalid", "invalid", "Y"] response = basic.ask_yes_no(response_attempt=3) self.assertTrue(response)
def test_ask_yes_no_4(self, input_mock): """Verify output when user answers provides invalid response.""" response = basic.ask_yes_no() self.assertIsNone(response)
def test_ask_yes_no_3(self, input_mock): """Verify output when user answers provides exit response.""" response = basic.ask_yes_no(response_attempt=3) self.assertIsNone(response)
def test_ask_yes_no_2(self, input_mock): """Verify output when user answers provides NO response.""" response = basic.ask_yes_no() self.assertFalse(response)
def test_ask_yes_no_1(self, input_mock): """Verify output when user answers provides YES response.""" response = basic.ask_yes_no() self.assertTrue(response)