From ce243a57b24d6adecb169487e706290d91b22d19 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 20 Feb 2024 10:57:56 +0300 Subject: Track filename in the errors R/qtl2 bundles can contain more than one file, of the same type. When errors are encountered in any of the files, we need to be able to inform the user which file it is, in addition to the line and column number. --- tests/r_qtl/test_r_qtl2_qc.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests/r_qtl') diff --git a/tests/r_qtl/test_r_qtl2_qc.py b/tests/r_qtl/test_r_qtl2_qc.py index d12172e..05db30e 100644 --- a/tests/r_qtl/test_r_qtl2_qc.py +++ b/tests/r_qtl/test_r_qtl2_qc.py @@ -124,9 +124,12 @@ def test_missing_files(filepath, expected): ("tests/r_qtl/test_files/test_geno.zip", tuple()), ("tests/r_qtl/test_files/geno_with_missing_genotypes.zip", - (InvalidValue(1, "AXR-1", "X", "Invalid value 'X'. Expected one of ('L', 'C')."), - InvalidValue(2, "EC.480C", "Y", "Invalid value 'Y'. Expected one of ('L', 'C')."), - InvalidValue(6, "HH.335C-Col/PhyA", "H", f"Invalid value 'H'. Expected one of ('L', 'C')."))))) + (InvalidValue("geno", 1, "AXR-1", "X", + "Invalid value 'X'. Expected one of ('L', 'C')."), + InvalidValue("geno", 2, "EC.480C", + "Y", "Invalid value 'Y'. Expected one of ('L', 'C')."), + InvalidValue("geno", 6, "HH.335C-Col/PhyA", "H", + f"Invalid value 'H'. Expected one of ('L', 'C')."))))) def test_geno_errors(filepath, expected): """ GIVEN: A R/qtl2 bundle @@ -145,10 +148,12 @@ def test_geno_errors(filepath, expected): ("tests/r_qtl/test_files/pheno_without_errors.zip", tuple()), ("tests/r_qtl/test_files/pheno_with_errors.zip", - (InvalidValue(1, "liver", "61.92", ("Invalid value '61.92'. Expected numerical value " - "with at least 3 decimal places.")), - InvalidValue(2, "spleen", "brrr", ("Invalid value 'brrr'. Expected numerical value " - "with at least 3 decimal places.")))))) + (InvalidValue("pheno", 1, "liver", "61.92", ( + "Invalid value '61.92'. Expected numerical value " + "with at least 3 decimal places.")), + InvalidValue("pheno", 2, "spleen", "brrr", ( + "Invalid value 'brrr'. Expected numerical value " + "with at least 3 decimal places.")))))) def test_pheno_errors(filepath, expected): """ GIVEN: A R/qtl2 bundle -- cgit v1.2.3