1
1
import os
2
2
import sys
3
- from nose .tools import raises
4
-
5
3
import pyexcel
6
-
4
+ from nose . tools import raises
7
5
from base import PyexcelMultipleSheetBase
8
6
9
7
if sys .version_info [0 ] == 2 and sys .version_info [1 ] < 7 :
@@ -44,7 +42,8 @@ def _write_test_file(self, file):
44
42
3,3,3,3
45
43
"""
46
44
self .rows = 3
47
- pyexcel .save_book_as (bookdict = self .content , dest_file_name = file )
45
+ pyexcel .save_book_as (bookdict = self .content ,
46
+ dest_file_name = file )
48
47
49
48
def setUp (self ):
50
49
self .testfile = "multiple3.xlsx"
@@ -68,7 +67,7 @@ def test_load_a_single_sheet2(self):
68
67
69
68
@raises (IndexError )
70
69
def test_load_a_single_sheet3 (self ):
71
- pyexcel .load_book ( self .testfile , sheet_index = 10000 )
70
+ pyexcel .get_book ( file_name = self .testfile , sheet_index = 10000 )
72
71
73
72
@raises (KeyError )
74
73
def test_load_a_single_sheet4 (self ):
@@ -110,7 +109,7 @@ def test_add_book1(self):
110
109
b1 = pyexcel .get_book (file_name = self .testfile )
111
110
b2 = pyexcel .get_book (file_name = self .testfile2 )
112
111
b3 = b1 + b2
113
- content = pyexcel . utils . to_dict ( b3 )
112
+ content = b3 . dict
114
113
sheet_names = content .keys ()
115
114
assert len (sheet_names ) == 6
116
115
for name in sheet_names :
@@ -123,12 +122,12 @@ def test_add_book1(self):
123
122
124
123
def test_add_book1_in_place (self ):
125
124
"""
126
- test this scenario book1 += book2
125
+ test this scenario: book1 += book2
127
126
"""
128
127
b1 = pyexcel .BookReader (self .testfile )
129
128
b2 = pyexcel .BookReader (self .testfile2 )
130
129
b1 += b2
131
- content = pyexcel . utils . to_dict ( b1 )
130
+ content = b1 . dict
132
131
sheet_names = content .keys ()
133
132
assert len (sheet_names ) == 6
134
133
for name in sheet_names :
@@ -141,12 +140,12 @@ def test_add_book1_in_place(self):
141
140
142
141
def test_add_book2 (self ):
143
142
"""
144
- test this scenario book3 = book1 + sheet3
143
+ test this scenario: book3 = book1 + sheet3
145
144
"""
146
145
b1 = pyexcel .BookReader (self .testfile )
147
146
b2 = pyexcel .BookReader (self .testfile2 )
148
147
b3 = b1 + b2 ["Sheet3" ]
149
- content = pyexcel . utils . to_dict ( b3 )
148
+ content = b3 . dict
150
149
sheet_names = content .keys ()
151
150
assert len (sheet_names ) == 4
152
151
for name in sheet_names :
@@ -159,12 +158,12 @@ def test_add_book2(self):
159
158
160
159
def test_add_book2_in_place (self ):
161
160
"""
162
- test this scenario book3 = book1 + sheet3
161
+ test this scenario: book3 = book1 + sheet3
163
162
"""
164
163
b1 = pyexcel .BookReader (self .testfile )
165
164
b2 = pyexcel .BookReader (self .testfile2 )
166
165
b1 += b2 ["Sheet3" ]
167
- content = pyexcel . utils . to_dict ( b1 )
166
+ content = b1 . dict
168
167
sheet_names = content .keys ()
169
168
assert len (sheet_names ) == 4
170
169
for name in sheet_names :
@@ -177,25 +176,25 @@ def test_add_book2_in_place(self):
177
176
178
177
def test_add_book3 (self ):
179
178
"""
180
- test this scenario book3 = sheet1 + sheet2
179
+ test this scenario: book3 = sheet1 + sheet2
181
180
"""
182
181
b1 = pyexcel .BookReader (self .testfile )
183
182
b2 = pyexcel .BookReader (self .testfile2 )
184
183
b3 = b1 ["Sheet1" ] + b2 ["Sheet3" ]
185
- content = pyexcel . utils . to_dict ( b3 )
184
+ content = b3 . dict
186
185
sheet_names = content .keys ()
187
186
assert len (sheet_names ) == 2
188
187
assert content ["Sheet3" ] == self .content ["Sheet3" ]
189
188
assert content ["Sheet1" ] == self .content ["Sheet1" ]
190
189
191
190
def test_add_book4 (self ):
192
191
"""
193
- test this scenario book3 = sheet1 + book
192
+ test this scenario: book3 = sheet1 + book
194
193
"""
195
194
b1 = pyexcel .BookReader (self .testfile )
196
195
b2 = pyexcel .BookReader (self .testfile2 )
197
196
b3 = b1 ["Sheet1" ] + b2
198
- content = pyexcel . utils . to_dict ( b3 )
197
+ content = b3 . dict
199
198
sheet_names = content .keys ()
200
199
assert len (sheet_names ) == 4
201
200
for name in sheet_names :
0 commit comments