def testXMLInput(self): """ Test conversion of a chunk of BLAST XML. This is highly incomplete in what it tests. """ mockOpener = mockOpen(read_data=RECORD) with patch.object(builtins, 'open', mockOpener): reader = XMLRecordsReader('file.xml') record1, record2 = list(reader.records()) self.assertEqual(0, len(record1.alignments)) self.assertEqual(2, len(record2.alignments))
def testXMLInput(self): """ Test conversion of a chunk of BLAST XML. This is highly incomplete in what it tests. """ mockOpener = mockOpen(read_data=RECORD) with patch.object(builtins, 'open', mockOpener): reader = XMLRecordsReader('file.xml') record1, record2 = list(reader.records()) self.assertEqual(0, len(record1.alignments)) self.assertEqual(2, len(record2.alignments))
def testParams(self): """ When a BLAST XML file has been read, its parameters must be present in the reader instance. We only test a subset of the parameters. """ mockOpener = mockOpen(read_data=RECORD) with patch.object(builtins, 'open', mockOpener): reader = XMLRecordsReader('file.xml') list(reader.records()) self.assertEqual('BLASTN', reader.params['application']) self.assertEqual('virus-nt-20130719', reader.params['database'])
def testParams(self): """ When a BLAST XML file has been read, its parameters must be present in the reader instance. We only test a subset of the parameters. """ mockOpener = mockOpen(read_data=RECORD) with patch.object(builtins, 'open', mockOpener): reader = XMLRecordsReader('file.xml') list(reader.records()) self.assertEqual('BLASTN', reader.params['application']) self.assertEqual('virus-nt-20130719', reader.params['database'])