Use ''.splitlines() instead of split('\n')
authorDiane Trout <diane@ghic.org>
Fri, 20 Mar 2015 23:19:39 +0000 (16:19 -0700)
committerDiane Trout <diane@ghic.org>
Fri, 20 Mar 2015 23:19:39 +0000 (16:19 -0700)
it seems to handle byte vs text strings a bit better.

htsworkflow/util/hashfile.py
htsworkflow/util/test/test_ethelp.py

index c6cc0f9c0ff68fea380a80d783858052781bad61..5382865bd8757676d939df1e75f19e5801c3df15 100644 (file)
@@ -31,7 +31,7 @@ def make_md5sum_unix(filename, md5_cache):
     if retcode != 0:
         logger.error("Trouble with md5sum for {0}".format(filename))
         return None
-    lines = stdin.split(os.linesep)
+    lines = stdin.splitlines()
     md5sum = parse_md5sum_line(lines, filename)
     if md5sum is not None:
         logger.debug("Caching sum in {0}".format(md5_cache))
index 8d336fbc8f8ff293c6e666af8e955862e119056e..b3519f4d245baa67e1e27f64d441a96a42a83b81 100644 (file)
@@ -17,11 +17,11 @@ class testETHelper(TestCase):
 
     def test_indent(self):
         flat_foo = ElementTree.tostring(self.foo_tree)
-        self.failUnlessEqual(len(flat_foo.split('\n')), 1)
+        self.failUnlessEqual(len(flat_foo.splitlines()), 1)
 
         indent(self.foo_tree)
         pretty_foo = ElementTree.tostring(self.foo_tree)
-        self.failUnlessEqual(len(pretty_foo.split('\n')), 5)
+        self.failUnlessEqual(len(pretty_foo.splitlines()), 4)
 
     def test_flatten(self):
         self.failUnless(flatten(self.foo_tree), 'asdf')