def test_delete_sheets(self):
     """Can delete by sheet name"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     del b1["Sheet1"]  # bang, already deleted
Beispiel #2
0
 def test_delete_sheets(self):
     """Can delete by sheet name"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     del b1["Sheet1"]  # bang, already deleted
 def test_delete_sheets2(self):
     """Can delete by index"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1[2]
     del b1[1]
     assert len(b1.sheet_names()) == 1
     del b1[1]  # bang, already deleted
Beispiel #4
0
 def test_delete_sheets2(self):
     """Can delete by index"""
     b1 = pe.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1[2]
     del b1[1]
     assert len(b1.sheet_names()) == 1
     del b1[1]  # bang, already deleted
Beispiel #5
0
 def test_delete_sheets2(self):
     """repetitively delete first sheet"""
     b1 = pyexcel.load_book(self.testfile, library="pyexcel-odsr")
     del b1[0]
     assert len(b1.sheet_names()) == 2
     del b1[0]
     assert len(b1.sheet_names()) == 1
     del b1[0]
     assert len(b1.sheet_names()) == 0
 def test_delete_sheets2(self):
     """repetitively delete first sheet"""
     b1 = pyexcel.load_book(self.testfile)
     del b1[0]
     assert len(b1.sheet_names()) == 2
     del b1[0]
     assert len(b1.sheet_names()) == 1
     del b1[0]
     assert len(b1.sheet_names()) == 0
Beispiel #7
0
 def test_read_multiple_csv_into_book(self):
     book = pe.load_book(self.testfile)
     assert book.sheet_names() == ["Sheet1", "Sheet2", "Sheet3"]
     book["Sheet1"].format(int)
     assert self.content["Sheet1"] == book["Sheet1"].to_array()
     book["Sheet2"].format(int)
     assert self.content["Sheet2"] == book["Sheet2"].to_array()
     book["Sheet3"].format(int)
     assert self.content["Sheet3"] == book["Sheet3"].to_array()
def appendBook(filePath, bookName, genSheet, fuelSheet, lambdaSheet):
    os.chdir('/home')
    os.chdir(filePath)
    book = pyex.load_book(bookName)
    book["General Data"].row += genSheet
    book["Fuel System Data"].row += fuelSheet
    book["Lambda Data"].row += lambdaSheet
    book.save_as(bookName)
    return
 def test_read_multiple_csv_into_book(self):
     book = pe.load_book(self.testfile)
     assert book.sheet_names() == ["Sheet1", "Sheet2", "Sheet3"]
     book["Sheet1"].format(int)
     assert self.content["Sheet1"] == book["Sheet1"].to_array()
     book["Sheet2"].format(int)
     assert self.content["Sheet2"] == book["Sheet2"].to_array()
     book["Sheet3"].format(int)
     assert self.content["Sheet3"] == book["Sheet3"].to_array()
Beispiel #10
0
 def test_delete_sheets4(self):
     """repetitively delete first sheet"""
     b1 = pe.load_book(self.testfile)
     del b1[0]
     assert len(b1.sheet_names()) == 2
     del b1[0]
     assert len(b1.sheet_names()) == 1
     del b1[0]
     assert len(b1.sheet_names()) == 0
Beispiel #11
0
 def test_read_custom_made_csvz_multiple_hseet(self):
     data = [[1, 4, 9], [2, 5, 8], [3, 6, 7]]
     book = pe.load_book(os.path.join("tests", "fixtures", "test-multiple.csvz"))
     assert book.sheet_names() == ["sheet1", "sheet2", "sheet3"]
     book[0].format(int)
     book[1].format(int)
     book[2].format(int)
     assert data == book[0].to_array()
     assert data == book[1].to_array()
     assert data == book[2].to_array()
 def test_read_custom_made_csvz_multiple_hseet(self):
     data = [[1, 4, 9], [2, 5, 8], [3, 6, 7]]
     book = pe.load_book(
         os.path.join("tests", "fixtures", "test-multiple.csvz"))
     assert book.sheet_names() == ["sheet1", "sheet2", "sheet3"]
     book[0].format(int)
     book[1].format(int)
     book[2].format(int)
     assert data == book[0].to_array()
     assert data == book[1].to_array()
     assert data == book[2].to_array()
Beispiel #13
0
 def test_issue_03(self):
     file_prefix = "issue_03_test"
     csv_file = "%s.csv" % file_prefix
     xls_file = "%s.xls" % file_prefix
     my_sheet_name = "mysheetname"
     data = [[1,1]]
     sheet = pe.Sheet(data, name=my_sheet_name)
     sheet.save_as(csv_file)
     assert(os.path.exists(csv_file))
     sheet.save_as(xls_file)
     book = pe.load_book(xls_file)
     assert book.sheet_names()[0] == my_sheet_name
     os.unlink(csv_file)
     os.unlink(xls_file)
 def test_delete_sheets(self):
     b1 = pyexcel.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     try:
         del b1["Sheet1"]
         assert 1 == 2
     except KeyError:
         assert 1 == 1
     del b1[1]
     assert len(b1.sheet_names()) == 1
     try:
         del b1[1]
         assert 1 == 2
     except IndexError:
         assert 1 == 1
 def test_delete_sheets(self):
     b1 = pyexcel.load_book(self.testfile)
     assert len(b1.sheet_names()) == 3
     del b1["Sheet1"]
     assert len(b1.sheet_names()) == 2
     try:
         del b1["Sheet1"]
         assert 1==2
     except KeyError:
         assert 1==1
     del b1[1]
     assert len(b1.sheet_names()) == 1
     try:
         del b1[1]
         assert 1==2
     except IndexError:
         assert 1==1
 def test_load_a_single_sheet2(self):
     b1 = pyexcel.load_book(self.testfile, sheet_index=2)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet3'].to_array() == self.content['Sheet3']
Beispiel #17
0
 def test_load_a_single_sheet2(self):
     b1 = pe.load_book(self.testfile, sheet_index=1)
     b1['Sheet2'].format(int)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet2'].to_array() == self.content['Sheet2']
Beispiel #18
0
 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     self.assertEqual(self.content, actual)
Beispiel #19
0
 def test_load_a_single_sheet3(self):
     pe.load_book(self.testfile, sheet_index=10000)
 def test_delete_sheets3(self):
     """Test float in []"""
     b1 = pe.load_book(self.testfile)
     del b1[1.1]
Beispiel #21
0
 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     self.assertEqual(self.content, actual)
Beispiel #22
0
 def test_load_a_single_sheet2(self):
     b1 = pyexcel.load_book(self.testfile,
                            sheet_index=0,
                            library="pyexcel-odsr")
     assert len(b1.sheet_names()) == 1
     assert b1["Sheet1"].to_array() == self.content["Sheet1"]
Beispiel #23
0
 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     assert actual == self.content
 def test_load_a_single_sheet3(self):
     pyexcel.load_book(self.testfile, sheet_index=10000)
Beispiel #25
0
 def test_delete_sheets3(self):
     """Test float in []"""
     b1 = pe.load_book(self.testfile)
     del b1[1.1]
Beispiel #26
0
 def test_load_a_single_sheet4(self):
     pe.load_book(self.testfile, sheet_name="Not exist")
Beispiel #27
0
 def test_book_reader_to_dict2(self):
     r = pe.load_book(self.testfile)
     actual = r.to_dict()
     assert actual == self.content
 def test_load_a_single_sheet4(self):
     pyexcel.load_book(self.testfile, sheet_name="Not exist")
 def test_load_a_single_sheet2(self):
     b1 = pyexcel.load_book(self.testfile, sheet_index=2)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet3'].to_array() == self.content['Sheet3']
Beispiel #30
0
 def test_load_a_single_sheet(self):
     b1 = pe.load_book(self.testfile, sheet_name="Sheet1")
     b1["Sheet1"].format(int)
     assert len(b1.sheet_names()) == 1
     assert b1["Sheet1"].to_array() == self.content["Sheet1"]
 def test_load_a_single_sheet2(self):
     b1 = pe.load_book(self.testfile, sheet_index=1)
     b1['Sheet2'].format(int)
     assert len(b1.sheet_names()) == 1
     assert b1['Sheet2'].to_array() == self.content['Sheet2']