def setUp(self): self.engine = sqlalchemy.create_engine(engine_string1, echo=False) test_db_utils.create_empty_test_db() phage_data1 = test_data_utils.get_trixie_phage_data() phage_data1["PhageID"] = "Trixie" phage_data1["HostGenus"] = "Mycobacterium" phage_data1["Accession"] = "ABC123" phage_data1["Cluster"] = "A" phage_data1["Subcluster"] = "A1" phage_data1["Sequence"] = "atcg" phage_data1["Length"] = 6 phage_data1["DateLastModified"] = constants.EMPTY_DATE test_db_utils.insert_phage_data(phage_data1) gene_data1 = test_data_utils.get_trixie_gene_data() gene_data2 = test_data_utils.get_trixie_gene_data() gene_data1["PhageID"] = "Trixie" gene_data2["PhageID"] = "Trixie" gene_data1["GeneID"] = "Trixie_1" gene_data2["GeneID"] = "Trixie_2" test_db_utils.insert_gene_data(gene_data1) test_db_utils.insert_gene_data(gene_data2) self.phage_query = "SELECT * FROM phage where PhageID = 'Trixie'" self.gene_query = "SELECT * FROM gene where PhageID = 'Trixie'"
def test_get_phage_table_count_2(self): """Verify the correct number of phages is returned when the database contains one genome.""" phage_data = test_data_utils.get_trixie_phage_data() test_db_utils.insert_phage_data(phage_data) count = mysqldb.get_phage_table_count(self.engine) self.assertEqual(count, 1)
def setUp(self): test_db_utils.create_empty_test_db() test_db_utils.insert_phage_data( test_data_utils.get_trixie_phage_data()) test_db_utils.insert_gene_data(test_data_utils.get_trixie_gene_data()) self.engine = sqlalchemy.create_engine(engine_string, echo=False) self.connection = self.engine.connect()
def setUp(self): self.engine = sqlalchemy.create_engine(engine_string1, echo=False) test_db_utils.create_empty_test_db() phage_data1 = test_data_utils.get_trixie_phage_data() phage_data2 = test_data_utils.get_trixie_phage_data() phage_data3 = test_data_utils.get_trixie_phage_data() phage_data1["PhageID"] = "L5" phage_data2["PhageID"] = "Trixie" phage_data3["PhageID"] = "D29" phage_data1["HostGenus"] = "Mycobacterium" phage_data2["HostGenus"] = "Mycobacterium" phage_data3["HostGenus"] = "Gordonia" phage_data1["Accession"] = "ABC123" phage_data2["Accession"] = "XYZ456" phage_data3["Accession"] = "" phage_data1["Cluster"] = "A" phage_data2["Cluster"] = "B" phage_data3["Cluster"] = "NULL" phage_data1["Subcluster"] = "A1" phage_data2["Subcluster"] = "NULL" phage_data3["Subcluster"] = "NULL" phage_data1["Sequence"] = "atcg" phage_data2["Sequence"] = "AATT" phage_data3["Sequence"] = "GGCC" phage_data1["Length"] = 6 phage_data2["Length"] = 4 phage_data3["Length"] = 5 phage_data1["DateLastModified"] = constants.EMPTY_DATE phage_data2["DateLastModified"] = constants.EMPTY_DATE phage_data3["DateLastModified"] = constants.EMPTY_DATE phage_data_list = [phage_data1, phage_data2, phage_data3] for phage_data in phage_data_list: test_db_utils.insert_phage_data(phage_data) gene_data1 = test_data_utils.get_trixie_gene_data() gene_data2 = test_data_utils.get_trixie_gene_data() gene_data3 = test_data_utils.get_trixie_gene_data() gene_data4 = test_data_utils.get_trixie_gene_data() gene_data1["PhageID"] = "Trixie" gene_data2["PhageID"] = "Trixie" gene_data3["PhageID"] = "Trixie" gene_data4["PhageID"] = "D29" gene_data1["GeneID"] = "Trixie_1" gene_data2["GeneID"] = "Trixie_2" gene_data3["GeneID"] = "Trixie_3" gene_data4["GeneID"] = "D29_1" gene_data_list = [gene_data1, gene_data2, gene_data3, gene_data4] for gene_data in gene_data_list: test_db_utils.insert_gene_data(gene_data) self.phage_query = "SELECT * FROM phage" self.gene_query = "SELECT * FROM gene"