# HG changeset patch # User Rémi Cardona # Date 1442241903 -7200 # Node ID 444b1df7b4cb6f864c4d7d77d7a91257feb4bfb4 # Parent 3274a1648c7e85c0d552ed4f06b6e5b85a89fd72 [dataimport] port ucsvreader tests to io.BytesIO diff -r 3274a1648c7e -r 444b1df7b4cb 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 . """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'']])