Skip to content
Snippets Groups Projects
Commit 38488d6f authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files

update all the tests and usages of the read function

parent 2dab6d97
Branches
Tags
No related merge requests found
Pipeline #34026 passed
......@@ -77,12 +77,12 @@ def get_fams_info(families, logger):
"""
logger.info("Retrieving information from pan families")
fams_by_strain = {}
all_strains = []
all_strains = set()
for num, fam in families.items():
fams_by_strain[num] = {}
for gene in fam:
read_gene(gene, num, fams_by_strain, all_strains)
sort_all_strains = sorted(all_strains, key=utils.sort_genomes_by_name)
sort_all_strains = sorted(list(all_strains), key=utils.sort_genomes_by_name)
return fams_by_strain, sort_all_strains
......
......@@ -156,9 +156,9 @@ def test_read_gene():
gene = "ESCO.1016.00012.i012_00015"
num = "1"
fams_by_strain = {"1": {}}
all_strains = []
all_strains = set()
upan.read_gene(gene, num, fams_by_strain, all_strains)
assert all_strains == ["ESCO.1016.00012"]
assert all_strains == {"ESCO.1016.00012"}
assert fams_by_strain == {"1": {"ESCO.1016.00012": [gene]}}
......@@ -170,9 +170,9 @@ def test_read_gene_other_format():
gene = "my_gene-name_other_0001"
num = "1"
fams_by_strain = {"1": {}}
all_strains = []
all_strains = set()
upan.read_gene(gene, num, fams_by_strain, all_strains)
assert all_strains == ["my_gene-name_other"]
assert all_strains == {"my_gene-name_other"}
assert fams_by_strain == {"1": {"my_gene-name_other": [gene]}}
......@@ -185,9 +185,9 @@ def test_read_gene_strain_known():
gene = "ESCO.1016.00012.i012_00015"
num = "1"
fams_by_strain = {"1": {"ESCO.1016.00012": ["ESCO.1016.00012.i001_01"]}}
all_strains = ["ESCO.1016.00012"]
all_strains = {"ESCO.1016.00012"}
upan.read_gene(gene, num, fams_by_strain, all_strains)
assert all_strains == ["ESCO.1016.00012"]
assert all_strains == {"ESCO.1016.00012"}
assert fams_by_strain == {"1": {"ESCO.1016.00012": ["ESCO.1016.00012.i001_01",
gene]}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment