Skip to content

Commit

Permalink
make textblock windows and py34 safe
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed May 13, 2015
1 parent 653c5db commit 055296c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dask/tests/test_utils.py
Expand Up @@ -3,14 +3,14 @@
import os

def test_textblock():
text = '123 456 789 abc def ghi'.replace(' ', os.linesep)
with filetext(text) as fn:
text = b'123 456 789 abc def ghi'.replace(b' ', os.linesep.encode())
with filetext(text, mode='wb') as fn:
with open(fn, 'rb') as f:
text = textblock(f, 1, 10)
assert text == '456 789 '.replace(' ', os.linesep)
text = textblock(f, 1, 11)
assert text == ('456 789 '.replace(' ', os.linesep)).encode()
assert set(map(len, text.split())) == set([3])

assert textblock(f, 1, 10) == textblock(fn, 1, 10)

assert textblock(f, 0, 3) == '123' + os.linesep
assert textblock(f, 3 + len(os.linesep), 6) == '456' + os.linesep
assert textblock(f, 0, 3) == ('123' + os.linesep).encode()
assert textblock(f, 3 + len(os.linesep), 6) == ('456' + os.linesep).encode()

0 comments on commit 055296c

Please sign in to comment.