From b3b98ee60ed995d725d13d6037a5821490f934c7 Mon Sep 17 00:00:00 2001 From: xin-huang Date: Tue, 21 Jan 2025 11:04:03 +0100 Subject: [PATCH] Update --- tests/parsers/test_score_parser.py | 46 ++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/tests/parsers/test_score_parser.py b/tests/parsers/test_score_parser.py index a9f9c29..1a548fe 100644 --- a/tests/parsers/test_score_parser.py +++ b/tests/parsers/test_score_parser.py @@ -103,7 +103,7 @@ def test_add_score_parser_with_invalid_src(): add_score_parser(subparsers) # Add the `score` subcommand to the parser # Simulate command-line input - args = parser.parse_args( + args1 = parser.parse_args( [ "score", "--vcf", @@ -143,6 +143,48 @@ def test_add_score_parser_with_invalid_src(): ] ) + args2 = parser.parse_args( + [ + "score", + "--vcf", + "tests/data/example.vcf", + "--chr-name", + "chr1", + "--ref", + "tests/data/example.ref.ind.list", + "--tgt", + "tests/data/example.tgt.ind.list", + "--src", + "tests/data/example.src.ind.list", + "--win-len", + "50000", + "--win-step", + "10000", + "--num-src", + "2", # Expecting 2 populations + "--anc-alleles", + "tests/data/test.anc.allele.bed", + "--ploidy", + "2", + "--phased", + "--w", + "0.3", + "--x", + "0.5", + "--y", + "0.1", + "--output", + "output/results.tsv", + "--q", + "0.95", + "--workers", + "4", + ] + ) + # Trigger _run_score to validate the arguments and raise ValueError with pytest.raises(ValueError, match=r"The number of populations in the file .* does not match .*"): - _run_score(args) + _run_score(args1) + + with pytest.raises(ValueError, match=r"The length of y .* does not match .*"): + _run_score(args2)