mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Attempt binary conversion of newlines if UTF conversion fails.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import tempfile
|
||||
|
||||
from galaxy.datatypes.sniff import convert_newlines_sep2tabs, sep2tabs
|
||||
from galaxy.datatypes.sniff import (
|
||||
convert_newlines,
|
||||
convert_newlines_sep2tabs,
|
||||
get_test_fname,
|
||||
sep2tabs,
|
||||
)
|
||||
|
||||
|
||||
def assert_converts_to_1234_sep2tabs(content, line_ending="\n"):
|
||||
@@ -23,6 +28,13 @@ def assert_converts_to_1234_convert_sep2tabs(content, expected='1\t2\n3\t4\n', l
|
||||
assert expected == open(tf.name).read()
|
||||
|
||||
|
||||
def test_convert_newlines_non_utf():
|
||||
fname = get_test_fname("dosimzml")
|
||||
rval = convert_newlines(fname, tmp_prefix="gxtest", tmp_dir=tempfile.gettempdir(), in_place=False)
|
||||
new_file = rval[1]
|
||||
assert open(new_file, "rb").read() == open(get_test_fname("1.imzml"), "rb").read()
|
||||
|
||||
|
||||
def test_sep2tabs():
|
||||
assert_converts_to_1234_sep2tabs("1 2\n3 4\n")
|
||||
assert_converts_to_1234_sep2tabs("1 2\n3 4\n")
|
||||
|
||||
Reference in New Issue
Block a user