Example #1
0
    def test_both_ways(self):
        filename = "Roche/E3MFGYR02_random_10_reads.sff"
        with open(filename, "rb") as handle:
            index1 = sorted(_sff_read_roche_index(handle))
        with open(filename, "rb") as handle:
            index2 = sorted(_sff_do_slow_index(handle))
        self.assertEqual(index1, index2)
        with open(filename, "rb") as handle:
            self.assertEqual(len(index1), len(list(SffIterator(handle))))
        with open(filename, "rb") as handle:
            self.assertEqual(len(index1),
                             len(list(SffIterator(BytesIO(handle.read())))))

        if sys.platform != "win32" and sys.version_info[0] < 3:
            # Can be lazy and treat as binary...
            with open(filename, "r") as handle:
                self.assertEqual(len(index1), len(list(SffIterator(handle))))
            with open(filename) as handle:
                index2 = sorted(_sff_read_roche_index(handle))
            self.assertEqual(index1, index2)
            with open(filename, "r") as handle:
                index2 = sorted(_sff_do_slow_index(handle))
            self.assertEqual(index1, index2)
            with open(filename, "r") as handle:
                self.assertEqual(len(index1), len(list(SffIterator(handle))))
            with open(filename, "r") as handle:
                self.assertEqual(
                    len(index1),
                    len(list(SffIterator(BytesIO(handle.read())))))
Example #2
0
    def test_both_ways(self):
        filename = "Roche/E3MFGYR02_random_10_reads.sff"
        with open(filename, "rb") as handle:
            index1 = sorted(_sff_read_roche_index(handle))
        with open(filename, "rb") as handle:
            index2 = sorted(_sff_do_slow_index(handle))
        self.assertEqual(index1, index2)
        with open(filename, "rb") as handle:
            self.assertEqual(len(index1), len(list(SffIterator(handle))))
        with open(filename, "rb") as handle:
            self.assertEqual(len(index1), len(list(SffIterator(BytesIO(handle.read())))))

        if sys.platform != "win32" and sys.version_info[0] < 3:
            # Can be lazy and treat as binary...
            with open(filename, "r") as handle:
                self.assertEqual(len(index1), len(list(SffIterator(handle))))
            with open(filename) as handle:
                index2 = sorted(_sff_read_roche_index(handle))
            self.assertEqual(index1, index2)
            with open(filename, "r") as handle:
                index2 = sorted(_sff_do_slow_index(handle))
            self.assertEqual(index1, index2)
            with open(filename, "r") as handle:
                self.assertEqual(len(index1), len(list(SffIterator(handle))))
            with open(filename, "r") as handle:
                self.assertEqual(len(index1), len(list(SffIterator(BytesIO(handle.read())))))
 def test_index(self):
     filename = "Roche/greek.sff"
     with open(filename, "rb") as a_handle, open(filename,
                                                 "rb") as b_handle:
         index1 = sorted(_sff_read_roche_index(a_handle))
         index2 = sorted(_sff_do_slow_index(b_handle))
         self.assertEqual(index1, index2)
Example #4
0
 def check_sff_read_roche_index(self, data, msg):
     handle = BytesIO(data)
     try:
         index = list(_sff_read_roche_index(handle))
     except ValueError as err:
         self.assertEqual(str(err), msg)
     else:
         self.assertTrue(False, "_sff_read_roche_index did not raise exception")
Example #5
0
 def check_sff_read_roche_index(self, data, msg):
     handle = BytesIO(data)
     try:
         index = list(_sff_read_roche_index(handle))
     except ValueError as err:
         self.assertEqual(str(err), msg)
     else:
         self.assertTrue(False, "_sff_read_roche_index did not raise exception")
Example #6
0
 def test_index(self):
     filename = "Roche/greek.sff"
     # with open(filename, "rb") as handle:
     #     for record in SffIterator(handle):
     #         print(record.id)
     with open(filename, "rb") as a_handle, open(filename, "rb") as b_handle:
         index1 = sorted(_sff_read_roche_index(a_handle))
         index2 = sorted(_sff_do_slow_index(b_handle))
         self.assertEqual(index1, index2)
Example #7
0
 def test_index(self):
     filename = "Roche/greek.sff"
     # with open(filename, "rb") as handle:
     #     for record in SffIterator(handle):
     #         print(record.id)
     with open(filename, "rb") as a_handle, open(filename, "rb") as b_handle:
         index1 = sorted(_sff_read_roche_index(a_handle))
         index2 = sorted(_sff_do_slow_index(b_handle))
         self.assertEqual(index1, index2)
Example #8
0
 def test_both_ways(self):
     filename = "Roche/E3MFGYR02_random_10_reads.sff"
     with open(filename, "rb") as handle:
         index1 = sorted(_sff_read_roche_index(handle))
     with open(filename, "rb") as handle:
         index2 = sorted(_sff_do_slow_index(handle))
     self.assertEqual(index1, index2)
     with open(filename, "rb") as handle:
         self.assertEqual(len(index1), len(list(SffIterator(handle))))
     with open(filename, "rb") as handle:
         self.assertEqual(len(index1), len(list(SffIterator(BytesIO(handle.read())))))
Example #9
0
 def check_sff_read_roche_index(self, data, msg):
     handle = BytesIO(data)
     with self.assertRaises(ValueError) as cm:
         index = list(_sff_read_roche_index(handle))
     self.assertEqual(str(cm.exception), msg)