Beispiel #1
0
    def testReadFile(self):
        data = [
            (b"\xef\xbb\xbfFoo", "Foo"),
            (b"Bar", "Bar"),
        ]

        for src, expected in data:
            fl = BytesIO(src)
            dst = readFile(fl)
            self.assertEqual(dst, expected)
    def testReadFile(self):
        data = [
            (b"\xef\xbb\xbfFoo", "Foo"),
            (b"Bar", "Bar"),
            ]

        for src, expected in data:
            fl = BytesIO(src)
            dst = readFile(fl)
            self.assertEqual(dst, expected)
Beispiel #3
0
    def convert(self, filename):
        ext = os.path.splitext(filename)[1]
        if ext == '.gz':
            fl = gzip.open(filename, 'rb')
        else:
            fl = open(filename, 'rb')
        src = readFile(fl)

        src = skipHeader(src)
        return self._doConvert(src)