예제 #1
0
 def test_construct_tickets_1(self):
     """Verify two tickets are constructed correctly.
     The first ticket contains all required and optional fields.
     The second ticket contains all required fields."""
     dict_list = [self.ticket_dict1, self.ticket_dict4]
     eval_data_dict = {
         "eval_mode": "custom_eval_mode",
         "eval_flag_dict": {
             "check_locus_tag": False
         }
     }
     list_of_tickets = tickets.construct_tickets(dict_list, eval_data_dict,
                                                 "function",
                                                 self.required_keys,
                                                 self.optional_keys,
                                                 self.keywords)
     with self.subTest():
         self.assertEqual(len(list_of_tickets), 2)
     with self.subTest():
         self.assertEqual(list_of_tickets[0].id, 1)
     with self.subTest():
         self.assertEqual(list_of_tickets[0].eval_mode, "final")
     with self.subTest():
         self.assertEqual(list_of_tickets[0].description_field, "product")
     with self.subTest():
         self.assertTrue(list_of_tickets[0].eval_flags["check_locus_tag"])
     with self.subTest():
         self.assertEqual(list_of_tickets[1].id, 2)
     with self.subTest():
         self.assertEqual(list_of_tickets[1].eval_mode, "custom_eval_mode")
     with self.subTest():
         self.assertEqual(list_of_tickets[1].description_field, "function")
     with self.subTest():
         self.assertFalse(list_of_tickets[1].eval_flags["check_locus_tag"])
예제 #2
0
    def test_construct_tickets_3(self):
        """Verify four tickets constructed correctly. The first two tickets
        contain all required and optional fields. The second two tickets
        contain all required fields. Verify that each eval_flag dictionary
        is a separate object that can be modified without impacting the other
        eval_flag dictionaries."""

        tkt_dict1 = {}
        tkt_dict1["type"] = "add"
        tkt_dict1["phage_id"] = "Trixie"
        tkt_dict1["description_field"] = "product"
        tkt_dict1["eval_mode"] = "final"

        tkt_dict2 = {}
        tkt_dict2["type"] = "add"
        tkt_dict2["phage_id"] = "L5"
        tkt_dict2["description_field"] = "product"
        tkt_dict2["eval_mode"] = "final"

        tkt_dict3 = {}
        tkt_dict3["type"] = "add"
        tkt_dict3["phage_id"] = "RedRock"

        tkt_dict4 = {}
        tkt_dict4["type"] = "add"
        tkt_dict4["phage_id"] = "Bxb1"

        dict_list = [tkt_dict1, tkt_dict2, tkt_dict3, tkt_dict4]
        eval_data_dict = {
            "eval_mode": "custom_eval_mode",
            "eval_flag_dict": {
                "check_locus_tag": False
            }
        }
        tkt_list = tickets.construct_tickets(dict_list, eval_data_dict,
                                             "function", self.required_keys,
                                             self.optional_keys, self.keywords)

        tkt_list[0].eval_flags["check_locus_tag"] = 0
        tkt_list[1].eval_flags["check_locus_tag"] = 1
        tkt_list[2].eval_flags["check_locus_tag"] = 2
        tkt_list[3].eval_flags["check_locus_tag"] = 3

        with self.subTest():
            self.assertEqual(tkt_list[0].eval_flags["check_locus_tag"], 0)
        with self.subTest():
            self.assertEqual(tkt_list[1].eval_flags["check_locus_tag"], 1)
        with self.subTest():
            self.assertEqual(tkt_list[2].eval_flags["check_locus_tag"], 2)
        with self.subTest():
            self.assertEqual(tkt_list[3].eval_flags["check_locus_tag"], 3)
예제 #3
0
 def test_construct_tickets_2(self):
     """Verify one ticket is constructed correctly. The second data
     dictionary is not structured correctly."""
     dict_list = [self.ticket_dict1, self.ticket_dict2]
     eval_data_dict = {
         "eval_mode": "custom_eval_mode",
         "eval_flag_dict": {}
     }
     list_of_tickets = tickets.construct_tickets(dict_list, eval_data_dict,
                                                 "function",
                                                 self.required_keys,
                                                 self.optional_keys,
                                                 self.keywords)
     with self.subTest():
         self.assertEqual(len(list_of_tickets), 1)