Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
xin-huang committed Jan 21, 2025
1 parent 81584b9 commit b3b98ee
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions tests/parsers/test_score_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)

0 comments on commit b3b98ee

Please sign in to comment.