test/unittest_dataimport.py
author Rémi Cardona <remi.cardona@logilab.fr>
Mon, 26 May 2014 12:10:22 +0200
changeset 9814 faf0511ac181
parent 9181 2eac0aa1d3f6
child 9695 aa982b7c3f2a
permissions -rw-r--r--
[web/data] Remove broken backward compatibility function popupLoginBox() was deprecated in favor of cw.htmlhelpers.popupLoginBox() However, the use of cw.utils.deprecatedFunction() is broken. In firebug: >>> popupLoginBox() TypeError: newfunc is undefined cubicweb.js:113 (ligne 13) This function was modified back in 2010, so it's been broken for 4 years. Let's just get rid of it. Closes #4042978

from StringIO import StringIO
from logilab.common.testlib import TestCase, unittest_main
from cubicweb import dataimport
class UcsvreaderTC(TestCase):

    def test_empty_lines_skipped(self):
        stream = StringIO('''a,b,c,d,
1,2,3,4,
,,,,
,,,,
''')
        self.assertEqual([[u'a', u'b', u'c', u'd', u''],
                          [u'1', u'2', u'3', u'4', u''],
                          ],
                         list(dataimport.ucsvreader(stream)))
        stream.seek(0)
        self.assertEqual([[u'a', u'b', u'c', u'd', u''],
                          [u'1', u'2', u'3', u'4', u''],
                          [u'', u'', u'', u'', u''],
                          [u'', u'', u'', u'', u'']
                          ],
                         list(dataimport.ucsvreader(stream, skip_empty=False)))


if __name__ == '__main__':
    unittest_main()