def test_dump_xls_with_dict(self): fin = io.StringIO(u'{"a": {}}\n') fout = io.BytesIO() dump_excel(fin, fout, DumpXLS) fin.close() fout.close()
def test_dumpcexcel_xls(self): fin = open('./fixture/files/expand.1.json', 'r') fout = open('./fixture/files/tmp.output.1.xls', 'wb') dump_excel(fin, fout, DumpXLS) fin.close() fout.close()
def test_dump_xls_with_non_ascii(self): fin = io.open('./fixture/files/expand.2.json', 'r', encoding='utf-8') fout = io.open('./fixture/files/tmp.output.2.xls', 'wb') dump_excel(fin, fout, DumpXLS) fin.close() fout.close()
def test_dump_csv_with_non_ascii(self): fin = open('./fixture/files/expand.2.json', 'r') fout = open('./fixture/files/tmp.output.2.csv', 'wb') dump_excel(fin, fout, DumpCSV) fin.close() fout.close()
def mkexcel(output, input, sort_, row, type_): klass = dumptool.DumpCSV if type_ == "xls": klass = dumptool.DumpXLS dump_excel(input, output, klass, read_row=row, sort_type=sort_) input.close() output.close()
def mkexcel(output, input, sort_, row, type_): if output == sys.stdout: output = click.get_binary_stream('stdout') klass = dumptool.DumpCSV if type_ == "xls": klass = dumptool.DumpXLS dump_excel(input, output, klass, read_row=row, sort_type=sort_) input.close() output.close()
def test_dumpexcel_csv_with_sort(self): fin = open('./fixture/files/expand.1.json', 'r') fout = open('./fixture/files/tmp.output.1.sort.csv', 'w') dump_excel(fin, fout, DumpCSV, sort_type=True) fin.close() fout.close() output = open('./fixture/files/output.1.sort.csv', 'r') fout = open('./fixture/files/tmp.output.1.sort.csv', 'r') self.assertEqual(output.read(), fout.read()) output.close() fout.close()
def test_dumpexcel_csv(self): fin = open('./fixture/files/expand.1.json', 'r') fout = open('./fixture/files/tmp.output.1.csv', 'wb') dump_excel(fin, fout, DumpCSV) fin.close() fout.close() output = open('./fixture/files/output.1.csv', 'r') fout = open('./fixture/files/tmp.output.1.csv', 'r') self.assertEqual(output.read(), fout.read()) output.close() fout.close()
def test_dump_excel_with_error(self): with self.assertRaises(ValueError): dump_excel(None, None, None)