2 from __future__ import absolute_import
5 from six.moves import StringIO
6 from unittest import TestCase
8 from htsworkflow.pipelines import summary
9 from .simulate_runfolder import TESTDATA_DIR
11 class SummaryTests(TestCase):
12 """Test elements of the summary file parser
14 def test_is_xml(self):
15 xmlfile = StringIO('<?xml version="1.0"?>\n<tag>\n')
16 htmlfile = StringIO('<html>\n<head></head>\n<body><p></p></body>\n</html>')
18 self.failUnlessEqual(summary.isxml_stream(xmlfile), True)
19 self.failUnlessEqual(xmlfile.tell(), 0)
21 self.failUnlessEqual(summary.isxml_stream(htmlfile), False)
23 def test_xml_summary_file(self):
24 pathname = os.path.join(TESTDATA_DIR, 'Summary-casava1.7.xml')
25 s = summary.SummaryGA(pathname)
26 self.failUnlessEqual(len(s.lane_results[0]), 8)
27 self.failUnlessEqual(s.lane_results[0][1].cluster, (1073893, 146344))
29 def test_html_summary_file(self):
30 pathname = os.path.join(TESTDATA_DIR, 'Summary-ipar130.htm')
31 s = summary.SummaryGA(pathname)
32 self.failUnlessEqual(len(s.lane_results[0]), 8)
33 self.failUnlessEqual(s.lane_results[0][1].cluster, (126910, 4300))
35 def test_hiseq_sample_summary_file(self):
36 pathname = os.path.join(TESTDATA_DIR, 'sample_summary_1_12.htm')
37 s = summary.SummaryGA(pathname)
41 from unittest import TestSuite, defaultTestLoader
43 suite.addTests(defaultTestLoader.loadTestsFromTestCase(SummaryTests))
47 if __name__ == "__main__":
48 from unittest import main
49 main(defaultTest="suite")