From e713b566a873424709300110a78801fd49a74ea1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 3 Jan 2024 10:21:18 +0300 Subject: Add tests for `founder_geno` parsing. --- tests/r_qtl/test_r_qtl2_geno.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/r_qtl/test_r_qtl2_geno.py b/tests/r_qtl/test_r_qtl2_geno.py index 7b660a6..d323c4b 100644 --- a/tests/r_qtl/test_r_qtl2_geno.py +++ b/tests/r_qtl/test_r_qtl2_geno.py @@ -163,11 +163,32 @@ from r_qtl import r_qtl2 as rqtl2 "EC.480C": 2, "EC.66C": 2 })))) -def test_parse_geno_files(relpath,expected): - """ +def test_parse_geno_files(relpath, expected): + """Test parsing of geno files from the R/qtl2 bundle. + GIVEN: Path to a zip file with R/qtl2 data WHEN: we parse the geno file THEN: ensure that the data we get is as expected """ with ZipFile(Path(relpath).absolute(), "r") as zfile: - assert tuple(rqtl2.genotype_data(zfile, rqtl2.control_data(zfile))) == expected + assert tuple( + rqtl2.genotype_data(zfile, rqtl2.control_data(zfile))) == expected + +@pytest.mark.unit_test +@pytest.mark.parametrize( + "relpath,expected", + ( + ("tests/r_qtl/test_files/test_founder_geno.zip", + ()), + ("tests/r_qtl/test_files/test_founder_geno_transposed.zip", + ()))) +def test_parse_founder_geno_files(relpath, expected): + """Test parsing of founder_geno files from the R/qtl2 bundle. + + GIVEN: Path to a zip file with R/qtl2 data + WHEN: we parse the founder_geno file + THEN: ensure that the data we get is as expected + """ + with ZipFile(Path(relpath).absolute(), "r") as zfile: + assert tuple(rqtl2.founder_genotype_data( + zfile, rqtl2.control_data(zfile))) == expected -- cgit v1.2.3