Skip to content

Commit

Permalink
add test for failure
Browse files Browse the repository at this point in the history
  • Loading branch information
dpark01 committed Mar 19, 2024
1 parent bd0c3c1 commit e766748
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/unit/test_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,27 @@ def test_skani_contigs_to_refs(self):
expected_cluster = set(['ref.lasv.{}.fasta'.format(strain) for strain in ('josiah', 'KGH_G502')])
self.assertEqual(actual_cluster, expected_cluster)

def test_skani_no_big_contigs(self):
'''
Test that skani_dist tolerates empty (or practically empty) input query fasta
'''

inDir = os.path.join(util.file.get_test_input_path(), 'TestOrderAndOrient')
with util.file.tempfnames(('.skani.dist.out', '.skani.dist.filtered', '.clusters.filtered')) \
as (out_skani_dist, out_skani_dist_filtered, out_clusters_filtered):
contigs = os.path.join(inDir, 'contigs.lasv.one_small.fasta')
refs = [os.path.join(inDir, 'ref.ebov.{}.fasta'.format(strain))
for strain in ('lbr', 'sle', 'gin')]

assembly.skani_contigs_to_refs(contigs, refs, out_skani_dist, out_skani_dist_filtered, out_clusters_filtered, threads=1)

with open(out_clusters_filtered, 'r') as inf:
clusters = inf.readlines()
self.assertEqual(len(clusters), 0)
with open(out_skani_dist, 'r') as inf:
lines = inf.readlines()
self.assertEqual(len(lines), 1)


class TestMutableSequence(unittest.TestCase):
''' Test the MutableSequence class '''
Expand Down

0 comments on commit e766748

Please sign in to comment.