aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-09-27 11:01:49 +0300
committerFrederick Muriuki Muriithi2022-09-27 11:01:49 +0300
commit149542045e0baedde9781cdd78dfba64920bb23f (patch)
tree0f37f8d4ea8d147b6381a8f161aaff9039a4d4eb
parent3474a14fa4aa34def76a180395752d554592c026 (diff)
downloadgenenetwork2-149542045e0baedde9781cdd78dfba64920bb23f.tar.gz
Unit Test: Fix unit test for Chromosome functions.
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py2
-rw-r--r--wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
index 24400b33..0d1bafc3 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
@@ -54,7 +54,7 @@ class TestGemmaMapping(unittest.TestCase):
this_chromosomes = {}
for i in range(1, 5):
this_chromosomes[f'CH{i}'] = (AttributeSetter({"name": f"CH{i}"}))
- chromosomes = AttributeSetter({"chromosomes": this_chromosomes})
+ chromosomes = AttributeSetter({"chromosomes": lambda cursor: this_chromosomes})
dataset_group = MockGroup(
{"name": "GP1", "genofile": "file_geno"})
diff --git a/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py b/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
index 868b0b0b..2e1b5810 100644
--- a/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
+++ b/wqflask/tests/unit/wqflask/marker_regression/test_run_mapping.py
@@ -45,7 +45,7 @@ class TestRunMapping(unittest.TestCase):
self.dataset = AttributeSetter(
{"fullname": "dataset_1", "group": self.group, "type": "ProbeSet"})
- self.chromosomes = AttributeSetter({"chromosomes": chromosomes})
+ self.chromosomes = AttributeSetter({"chromosomes": lambda cur: chromosomes})
self.trait = AttributeSetter(
{"symbol": "IGFI", "chr": "X1", "mb": 123313, "display_name": "Test Name"})
@@ -251,12 +251,13 @@ class TestRunMapping(unittest.TestCase):
def test_get_chr_length(self):
"""test for getting chromosome length"""
+ cursor = mock.MagicMock()
chromosomes = AttributeSetter({"chromosomes": self.chromosomes})
dataset = AttributeSetter({"species": chromosomes})
results = get_chr_lengths(
mapping_scale="physic", mapping_method="reaper", dataset=dataset, qtl_results=[])
chr_lengths = []
- for key, chromo in self.chromosomes.chromosomes.items():
+ for key, chromo in self.chromosomes.chromosomes(cursor).items():
chr_lengths.append({"chr": chromo.name, "size": chromo.length})
self.assertEqual(chr_lengths, results)