Skip to content

Commit

Permalink
Ensure iteration matches expectations.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsanchez committed Nov 23, 2020
1 parent 28aecb5 commit 73fbbe9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions q2_cutadapt/tests/test_demux.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,13 @@ def test_rename_files_single(self):
self.barcode_series)

seqs = self.per_sample_dir_fmt.sequences.iter_views(FastqGzFormat)
counter = 0
for fn, (sample_id, barcode) in zip(seqs,
self.barcode_series.iteritems()):
self.assertTrue(sample_id in str(fn))
self.assertTrue(barcode in str(fn))
counter += 1
self.assertEqual(counter, 2)

def test_rename_files_extra_samples_in_barcode_map(self):
barcode_series = pd.Series(['A', 'G', 'C'],
Expand All @@ -482,9 +485,12 @@ def test_rename_files_extra_samples_in_barcode_map(self):
barcode_series)

seqs = self.per_sample_dir_fmt.sequences.iter_views(FastqGzFormat)
counter = 0
for fn, (sample_id, barcode) in zip(seqs, barcode_series.iteritems()):
self.assertTrue(sample_id in str(fn))
self.assertTrue(barcode in str(fn))
counter += 1
self.assertEqual(counter, 2)

def test_write_empty_fastq_to_mux_barcode_in_seq_fmt(self):
_write_empty_fastq_to_mux_barcode_in_seq_fmt(self.untrimmed_dir_fmt)
Expand Down Expand Up @@ -568,9 +574,12 @@ def test_rename_files(self):
seqs = self.per_sample_dir_fmt.sequences.iter_views(FastqGzFormat)
exp = [('sample_a', 'A'), ('sample_a', 'A'),
('sample_b', 'G'), ('sample_b', 'G')]
counter = 0
for fn, (sample_id, barcode) in zip(seqs, exp):
self.assertTrue(sample_id in str(fn))
self.assertTrue(barcode in str(fn))
counter += 1
self.assertEqual(counter, 4)

def test_rename_files_extra_samples_in_barcode_map(self):
barcode_series = pd.Series(['A', 'G', 'C'],
Expand All @@ -587,9 +596,12 @@ def test_rename_files_extra_samples_in_barcode_map(self):
seqs = self.per_sample_dir_fmt.sequences.iter_views(FastqGzFormat)
exp = [('sample_a', 'A'), ('sample_a', 'A'),
('sample_b', 'G'), ('sample_b', 'G')]
counter = 0
for fn, (sample_id, barcode) in zip(seqs, exp):
self.assertTrue(sample_id in str(fn))
self.assertTrue(barcode in str(fn))
counter += 1
self.assertEqual(counter, 4)

def test_write_empty_fastq_to_mux_barcode_in_seq_fmt(self):
_write_empty_fastq_to_mux_barcode_in_seq_fmt(self.untrimmed_dir_fmt)
Expand Down

0 comments on commit 73fbbe9

Please sign in to comment.