Skip to content
Snippets Groups Projects
Commit cbf2077d authored by Hugo Madge Leon's avatar Hugo Madge Leon
Browse files

CLI + complete linting & coverage

parent dd65166d
No related branches found
No related tags found
3 merge requests!45Hugo new,!41I still don't know how this works,!40CI/CD, tests, and complete linting
Pipeline #14865 failed
This commit is part of merge request !41. Comments created here will be created in the context of that merge request.
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
import pytest import pytest
from Bio import SeqIO from Bio import SeqIO
from term_frag_sel.fragmentation import fragmentation from term_frag_sel.fragmentation import fragmentation # type: ignore
with open("./test_files/test.fasta", "r") as handle: with open("tests/test_files/test.fasta", "r", encoding="utf-8") as handle:
fasta = SeqIO.parse(handle, "fasta") fasta = SeqIO.parse(handle, "fasta")
# have to create the counts file # have to create the counts file
mu = 100 MU = 100
std = 10 STD = 10
a_prob = 0.22 A_PROB = 0.22
c_prob = 0.28 C_PROB = 0.28
t_prob = 0.25 T_PROB = 0.25
g_prob = 0.25 G_PROB = 0.25
def test_frag(): def test_frag():
......
"""Test utils.py functions.""" """Test utils.py functions."""
import pytest
import argparse import argparse
import pytest
from term_frag_sel.utils import check_positive, check_prob from term_frag_sel.utils import check_positive, check_prob # type: ignore
def test_positive(): def test_positive():
"""Test check_positive function.""" """Test check_positive function."""
assert check_positive("1") == 1 assert check_positive("1") == 1
assert check_positive("100") == 100 assert check_positive("100") == 100
assert check_positive("0") == 100
assert check_positive("2.2") == 2 assert check_positive("2.2") == 2
assert check_positive("2.6") == 3 assert check_positive("2.6") == 3
with pytest.raises(argparse.ArgumentTypeError):
check_positive("0")
with pytest.raises(argparse.ArgumentTypeError): with pytest.raises(argparse.ArgumentTypeError):
check_positive("-1") check_positive("-1")
with pytest.raises(argparse.ArgumentTypeError): with pytest.raises(argparse.ArgumentTypeError):
...@@ -30,7 +31,7 @@ def test_prob(): ...@@ -30,7 +31,7 @@ def test_prob():
check_prob("10") check_prob("10")
with pytest.raises(argparse.ArgumentTypeError): with pytest.raises(argparse.ArgumentTypeError):
check_prob("-1") check_prob("-1")
with pytest.raises(argparse.ArgumentTypeError): with pytest.raises(ValueError):
check_prob("string") check_prob("string")
with pytest.raises(argparse.ArgumentTypeError): with pytest.raises(ValueError):
check_prob("") check_prob("")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment