[dataimport] port ucsvreader tests to io.BytesIO
authorRémi Cardona <remi.cardona@logilab.fr>
Mon, 14 Sep 2015 16:45:03 +0200
changeset 10619 444b1df7b4cb
parent 10618 3274a1648c7e
child 10620 30ebd6b2eaf3
[dataimport] port ucsvreader tests to io.BytesIO
dataimport/test/test_csv.py
--- a/dataimport/test/test_csv.py	Mon Sep 14 18:56:29 2015 +0200
+++ b/dataimport/test/test_csv.py	Mon Sep 14 16:45:03 2015 +0200
@@ -17,7 +17,7 @@
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
 """unittest for cubicweb.dataimport.csv"""
 
-from StringIO import StringIO
+from io import BytesIO
 
 from logilab.common.testlib import TestCase, unittest_main
 
@@ -27,7 +27,7 @@
 class UcsvreaderTC(TestCase):
 
     def test_empty_lines_skipped(self):
-        stream = StringIO('''a,b,c,d,
+        stream = BytesIO(b'''a,b,c,d,
 1,2,3,4,
 ,,,,
 ,,,,
@@ -45,7 +45,7 @@
                          list(csv.ucsvreader(stream, skip_empty=False)))
 
     def test_skip_first(self):
-        stream = StringIO('a,b,c,d,\n1,2,3,4,\n')
+        stream = BytesIO(b'a,b,c,d,\n1,2,3,4,\n')
         reader = csv.ucsvreader(stream, skipfirst=True, ignore_errors=True)
         self.assertEqual(list(reader),
                          [[u'1', u'2', u'3', u'4', u'']])