def test_interface(self):
        with TmpDir() as dire:
            fname = os.path.join(dire, 'test.zip')
            self.make_zip_file(fname)

            rz = LocalRemoteZip(fname, min_buffer_size=50)
            ilist = rz.infolist()
            self.assertEqual(ilist[0].filename, 'file1')
            self.assertEqual(ilist[0].file_size, 10002)
            self.assertEqual(rz.read('file1'), b'X' + (b'A' * 10000) + b'Y')
            self.assertEqual(rz.read('file1'), b'X' + (b'A' * 10000) + b'Y')

            self.assertEqual(ilist[1].filename, 'file2')
            self.assertEqual(ilist[1].file_size, 13)
            self.assertEqual(rz.read('file2'), b'short content')

            self.assertEqual(ilist[2].filename, 'file3')
            self.assertEqual(ilist[2].file_size, 0)
            self.assertEqual(rz.read('file3'), b'')

            self.assertEqual(ilist[3].filename, 'file4')
            self.assertEqual(ilist[3].file_size, 9)
            self.assertEqual(rz.read('file4'), b'last file')

            self.assertIsNone(rz.testzip())
    def test_big_header(self):
        with TmpDir() as dire:
            fname = os.path.join(dire, 'test.zip')
            self.make_big_header_zip(fname, 2000)

            with LocalRemoteZip(fname) as rz:
                for i, finfo in enumerate(rz.infolist()):
                    self.assertEqual(finfo.filename,
                                     'test_long_header_file_{0}'.format(i))
                    self.assertEqual(finfo.file_size, 1)

                self.assertIsNone(rz.testzip())
 def test_zip64(self):
     rz = LocalRemoteZip('test_data/zip64.zip')
     self.assertEqual(rz.read('big_file'), b'\x00' * (1024 * 1024))
     self.assertIsNone(rz.testzip())