Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamtaranto committed Sep 24, 2024
1 parent e5f774d commit 0d19e68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/python/tests/test_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_consumed_after_count():

def test_consumed_after_consume():
kmer_table = oxli.KmerCountTable(ksize=16)
kmer_table.consume("ACGTACGXACGTACGT", allow_bad_kmers=True) # Length is 16
kmer_table.consume("ACGTACGXACGTACGT", skip_bad_kmers=True) # Length is 16
assert (
kmer_table.consumed == 16
), "consumed should be updated to 16 after consuming sequence"
Expand Down
6 changes: 3 additions & 3 deletions src/python/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ def test_consume_bad_DNA():
cg = oxli.KmerCountTable(4)
seq = "ATCGGX"
with pytest.raises(ValueError, match="bad k-mer encountered at position 2"):
cg.consume(seq, allow_bad_kmers=False)
cg.consume(seq, skip_bad_kmers=False)


def test_consume_bad_DNA_2():
# test an invalid base in first position
cg = oxli.KmerCountTable(4)
seq = "XATCGG"
with pytest.raises(ValueError, match="bad k-mer encountered at position 0"):
cg.consume(seq, allow_bad_kmers=False)
cg.consume(seq, skip_bad_kmers=False)


def test_consume_bad_DNA_ignore():
# we can ignore bad DNA
cg = oxli.KmerCountTable(4)
seq = "XATCGG"
print(cg.consume(seq, allow_bad_kmers=True))
print(cg.consume(seq, skip_bad_kmers=True))
assert cg.get("ATCG") == 1
assert cg.get("TCGG") == 1
assert cg.get("CCGA") == 1 # rc
Expand Down

0 comments on commit 0d19e68

Please sign in to comment.