示例#1
0
 def test_read_one_from_many_by_index(self):
     b = CSVZipBook(self.file, load_sheet_at_index=0)
     sheets = b.sheets()
     assert sheets['Sheet 1'] == [
         [u'1.0', u'2.0', u'3.0'],
         [u'4.0', u'5.0', u'6.0'],
         [u'7.0', u'8.0', u'9.0']
     ]
示例#2
0
 def test_read_one_from_many_by_name(self):
     b = CSVZipBook(self.file, load_sheet_with_name="Sheet 1")
     sheets = b.sheets()
     assert sheets['Sheet 1'] == [
         [u'1.0', u'2.0', u'3.0'],
         [u'4.0', u'5.0', u'6.0'],
         [u'7.0', u'8.0', u'9.0']
     ]
示例#3
0
 def test_reading(self):
     data = [[1,2,3]]
     zipbook = CSVZipWriter(self.file)
     sheet = zipbook.create_sheet(None)
     sheet.write_array(data)
     sheet.close()
     zipbook.close()
     zipreader = CSVZipBook(self.file)
     data = zipreader.sheets()
     assert data['pyexcel_sheet1'] == [['1','2','3']]
示例#4
0
def test_reading_from_memory():
    data = [[1,2,3]]
    io = get_io("csvz")
    zipbook = CSVZipWriter(io)
    sheet = zipbook.create_sheet(None)
    sheet.write_array(data)
    sheet.close()
    zipbook.close()
    zipreader = CSVZipBook(io)
    data = zipreader.sheets()
    assert data['pyexcel_sheet1'] == [['1','2','3']]