def test_fasta_badqual_id(self):
        wk = FastaIterator(seq=self.fastas, qual=self.bad_qual_id)
        gen = wk()

        # default behavior is to sliently ignore
        exp_ids = ['1', '2', '4', '5']
        obs_ids = [r['SequenceID'] for r in gen]

        self.assertEqual(obs_ids, exp_ids)
    def test_fasta_gen(self):
        wk = FastaIterator(seq=self.fastas)
        gen = wk()

        exp1 = {
            'SequenceID': '1',
            'Sequence': 'aattggcc',
            'Qual': None,
            'QualID': None
        }
        exp2 = {
            'SequenceID': '2',
            'Sequence': 'aattaatt',
            'Qual': None,
            'QualID': None
        }
        exp3 = {
            'SequenceID': '3',
            'Sequence': 'atat',
            'Qual': None,
            'QualID': None
        }
        exp4 = {
            'SequenceID': '4',
            'Sequence': 'attatt',
            'Qual': None,
            'QualID': None
        }
        exp5 = {
            'SequenceID': '5',
            'Sequence': 'ggccc',
            'Qual': None,
            'QualID': None
        }

        obs1 = next(gen)
        self.assertEqual(obs1, exp1)
        self.assertFalse(wk.failed)

        obs2 = next(gen)
        self.assertEqual(obs2, exp2)
        self.assertFalse(wk.failed)

        obs3 = next(gen)
        self.assertEqual(obs3, exp3)
        self.assertFalse(wk.failed)

        obs4 = next(gen)
        self.assertEqual(obs4, exp4)
        self.assertFalse(wk.failed)

        obs5 = next(gen)
        self.assertEqual(obs5, exp5)
        self.assertFalse(wk.failed)
    def test_fasta_qual(self):
        wk = FastaIterator(seq=self.fastas, qual=self.quals)
        gen = wk()

        exp1 = {
            'SequenceID': '1',
            'Sequence': 'aattggcc',
            'Qual': arange(1, 9),
            'QualID': '1'
        }
        exp2 = {
            'SequenceID': '2',
            'Sequence': 'aattaatt',
            'QualID': '2',
            'Qual': arange(1, 9)[::-1]
        }
        exp3 = {
            'SequenceID': '3',
            'Sequence': 'atat',
            'Qual': arange(1, 5),
            'QualID': '3'
        }
        exp4 = {
            'SequenceID': '4',
            'Sequence': 'attatt',
            'Qual': arange(1, 7),
            'QualID': '4'
        }
        exp5 = {
            'SequenceID': '5',
            'Sequence': 'ggccc',
            'Qual': arange(1, 6),
            'QualID': '5'
        }

        obs1 = next(gen)
        self.assertTrue((obs1['Qual'] == exp1['Qual']).all())
        obs1.pop('Qual')
        exp1.pop('Qual')
        self.assertEqual(obs1, exp1)
        self.assertFalse(wk.failed)

        obs2 = next(gen)
        self.assertTrue((obs2['Qual'] == exp2['Qual']).all())
        obs2.pop('Qual')
        exp2.pop('Qual')
        self.assertEqual(obs2, exp2)
        self.assertFalse(wk.failed)

        obs3 = next(gen)
        self.assertTrue((obs3['Qual'] == exp3['Qual']).all())
        obs3.pop('Qual')
        exp3.pop('Qual')
        self.assertEqual(obs3, exp3)
        self.assertFalse(wk.failed)

        obs4 = next(gen)
        self.assertTrue((obs4['Qual'] == exp4['Qual']).all())
        obs4.pop('Qual')
        exp4.pop('Qual')
        self.assertEqual(obs4, exp4)
        self.assertFalse(wk.failed)

        obs5 = next(gen)
        self.assertTrue((obs5['Qual'] == exp5['Qual']).all())
        obs5.pop('Qual')
        exp5.pop('Qual')
        self.assertEqual(obs5, exp5)
        self.assertFalse(wk.failed)