mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge branch 'release_16.04' into dev
This commit is contained in:
@@ -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
|
||||
@@ -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 = ''
|
||||
|
||||
@@ -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'
|
||||
Reference in New Issue
Block a user