Skip to content

Commit

Permalink
Match ZipArchive under Py3k to others:
Browse files Browse the repository at this point in the history
Return binary lines.
  • Loading branch information
tseaver committed Dec 28, 2012
1 parent 57b3b63 commit 7e98e6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions compoze/indexer.py
Expand Up @@ -9,7 +9,7 @@
import zipfile

from compoze._compat import StringIO
from compoze._compat import must_decode
from compoze._compat import must_encode


class TarArchive:
Expand Down Expand Up @@ -46,7 +46,7 @@ def names(self):
def lines(self, name):
if self.closed:
raise IOError('closed')
return must_decode(self.zipf.read(name)).split('\n')
return must_encode(self.zipf.read(name)).split(b'\n')

def extract(self, name, tempdir):
if self.closed:
Expand Down
5 changes: 3 additions & 2 deletions compoze/tests/test_indexer.py
Expand Up @@ -40,8 +40,9 @@ def test_lines(self):
archive = self._makeOne()
name = self._fixtureFiles()[0]['name']
lines = archive.lines(name)
self.assertEqual(lines[:2], ['This is the first line of text file 1.',
'This is the second line of text file 1.'])
self.assertEqual(lines[:2],
[b'This is the first line of text file 1.',
b'This is the second line of text file 1.'])

def test_extract(self):
import os
Expand Down

0 comments on commit 7e98e6e

Please sign in to comment.