コード例 #1
0
 def test_get_rows(self):
     fobj = StringIO(CSVDATA)
     reader = CSVUnicodeReader(fobj)
     resp = reader.get_rows()
     self.assertEqual(resp,
                      [[u'John', u'+3532344333'], [u'Peter', u'+345465454'],
                       [u'Lucy', u'+4464576556']])
     fobj.close()
コード例 #2
0
 def test_get_rows(self):
     fobj = StringIO(CSVDATA)
     reader = CSVUnicodeReader(fobj)
     resp = reader.get_rows()
     self.assertEqual(resp, [[u'John', u'+3532344333'],
                             [u'Peter', u'+345465454'],
                             [u'Lucy', u'+4464576556']])
     fobj.close()
コード例 #3
0
    def test_write_row(self):
        writer = CSVUnicodeWriter(open(TMPFILE, 'w'))
        row = [u'Pabl\0231', u'+345667781']
        writer.write_row(row)

        reader = CSVUnicodeReader(open(TMPFILE))
        resp = reader.get_rows()
        self.assertEqual(resp, [row])
        os.unlink(TMPFILE)
コード例 #4
0
 def test_write_row(self):
     writer = CSVUnicodeWriter(open(TMPFILE, 'w'))
     row = [u'Pabl\0231', u'+345667781']
     writer.write_row(row)
     
     reader = CSVUnicodeReader(open(TMPFILE))
     resp = reader.get_rows()
     self.assertEqual(resp, [row])
     os.unlink(TMPFILE)
コード例 #5
0
    def test_write_rows(self):
        writer = CSVUnicodeWriter(open(TMPFILE, 'w'))
        rows = [[u'Pablo', u'+345667781'], [u'Xabïé', u'+347327211'],
                [u'Raúls', u'+349494949'], [u'María', u'+312232111'],
                [u'André', u'+378544522']]

        writer.write_rows(rows)

        reader = CSVUnicodeReader(open(TMPFILE))
        resp = reader.get_rows()
        self.assertEqual(resp, rows)
        os.unlink(TMPFILE)
コード例 #6
0
 def test_write_rows(self):
     writer = CSVUnicodeWriter(open(TMPFILE, 'w'))
     rows = [[u'Pablo', u'+345667781'],
             [u'Xabïé', u'+347327211'],
             [u'Raúls', u'+349494949'],
             [u'María', u'+312232111'],
             [u'André', u'+378544522']]
     
     writer.write_rows(rows)
     
     reader = CSVUnicodeReader(open(TMPFILE))
     resp = reader.get_rows()
     self.assertEqual(resp, rows)
     os.unlink(TMPFILE)