Skip to content

Commit

Permalink
MRG: Fix skipmer test test_manysketch_skipm2n3 now that sourmash is…
Browse files Browse the repository at this point in the history
… updated (#568)

* fix skipmer test

* upd comment

* black

* break test again

* do heinous dev stuff

* fix fix comment
  • Loading branch information
ctb authored Jan 7, 2025
1 parent 2b75354 commit 48bb1c9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/python/tests/test_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,19 +1476,39 @@ def test_manysketch_skipm2n3(runtmp, capfd):
sigs = list(idx.signatures())
print(sigs)

assert len(sigs) == 3 # 3 dna, 3 skipmer. But sourmash can only read the DNA sigs!!
# add in a version check so this works under latest release AND latest
# dev.
ver = sourmash.version("sourmash")
major, minor, micro = map(int, ver.split(".")[:3])
assert major == 4
assert minor >= 8
if "dev" in ver:
assert len(sigs) == 6 # 3 dna, 3 skipmer.
else:
assert len(sigs) == 3 # 3 dna, 3 skipmer but not recognized yet.

# check moltypes, etc!
dna_md5sums = {
"short": "1474578c5c46dd09da4c2df29cf86621",
"short2": "4efeebd26644278e36b9553e018a851a",
"short3": "f85747ac4f473c4a71c1740d009f512b",
}
skip_md5sums = {
"short2": "ec6305f5d82e51659f3914d47fcc32ee",
"short": "0486fcae73545363da9cd5bfcf18d322",
"short3": "890557b39ae66d3177035296818de7c6",
}
for sig in sigs:
if sig.minhash.is_dna:
assert sig.minhash.ksize == 21
assert sig.minhash.scaled == 1
print("DNA: ", sig.name, sig.md5sum())
assert sig.md5sum() == dna_md5sums[sig.name]
elif sig.minhash.moltype == "skipm2n3":
print(sig.minhash.ksize, sig.minhash.scaled, sig.name, sig.md5sum())
assert sig.minhash.ksize == 31
assert sig.minhash.scaled == 30
assert sig.md5sum() == skip_md5sums[sig.name]

# read the file with python and check sigs
import zipfile, gzip, json
Expand Down

0 comments on commit 48bb1c9

Please sign in to comment.