Skip to content

Commit

Permalink
Merge branch 'release_16.04' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
carlfeberhard committed Jul 19, 2016
2 parents e1e0a3b + 10ac6ee commit 1e36eba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/datatypes/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ def get_file_peek( file_name, is_multi_byte=False, WIDTH=256, LINE_COUNT=5, skip
data_checked = False
temp = open( file_name, "U" )
last_line = ''
while count <= LINE_COUNT:
while count < LINE_COUNT:
line = last_line + temp.readline( WIDTH - len( last_line ) )
if line and not is_multi_byte and not data_checked:
# See if we have a compressed or binary file
Expand All @@ -993,7 +993,7 @@ def get_file_peek( file_name, is_multi_byte=False, WIDTH=256, LINE_COUNT=5, skip
if not line_wrap:
if '\n' in line:
i = line.index( '\n' )
last_line = line[i:]
last_line = line[i + 1:]
line = line[:i]
else:
last_line = ''
Expand Down
11 changes: 11 additions & 0 deletions test/unit/datatypes/test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Unit tests for base DataTypes.
.. seealso:: galaxy.datatypes.data
"""

from galaxy.datatypes.data import get_file_peek


def test_get_file_peek( ):
# should get the first 5 lines of the file without a trailing newline character
assert get_file_peek('test-data/1.tabular', line_wrap=False) == 'chr22\t1000\tNM_17\nchr22\t2000\tNM_18\nchr10\t2200\tNM_10\nchr10\thap\ttest\nchr10\t1200\tNM_11'

0 comments on commit 1e36eba

Please sign in to comment.