@@ -4188,7 +4188,7 @@ def test_to_excel_styleconverter(self):
4188
4188
self .assertEquals (openpyxl .style .Alignment .HORIZONTAL_CENTER ,
4189
4189
xlsx_style .alignment .horizontal )
4190
4190
4191
- def test_to_excel_header_styling (self ):
4191
+ def test_to_excel_header_styling_xls (self ):
4192
4192
4193
4193
import StringIO
4194
4194
s = StringIO .StringIO (
@@ -4210,9 +4210,8 @@ def test_to_excel_header_styling(self):
4210
4210
cols = ["Date" , "type" ])
4211
4211
4212
4212
try :
4213
+ import xlwt
4213
4214
import xlrd
4214
- import openpyxl
4215
- from openpyxl .cell import get_column_letter
4216
4215
except ImportError :
4217
4216
raise nose .SkipTest
4218
4217
@@ -4239,6 +4238,38 @@ def test_to_excel_header_styling(self):
4239
4238
self .assertEquals (2 , cell_xf .alignment .hor_align )
4240
4239
4241
4240
os .remove (filename )
4241
+
4242
+
4243
+ def test_to_excel_header_styling_xlsx (self ):
4244
+
4245
+ import StringIO
4246
+ s = StringIO .StringIO (
4247
+ """Date,ticker,type,value
4248
+ 2001-01-01,x,close,12.2
4249
+ 2001-01-01,x,open ,12.1
4250
+ 2001-01-01,y,close,12.2
4251
+ 2001-01-01,y,open ,12.1
4252
+ 2001-02-01,x,close,12.2
4253
+ 2001-02-01,x,open ,12.1
4254
+ 2001-02-01,y,close,12.2
4255
+ 2001-02-01,y,open ,12.1
4256
+ 2001-03-01,x,close,12.2
4257
+ 2001-03-01,x,open ,12.1
4258
+ 2001-03-01,y,close,12.2
4259
+ 2001-03-01,y,open ,12.1""" )
4260
+ df = read_csv (s , parse_dates = ["Date" ])
4261
+ pdf = df .pivot_table (values = "value" , rows = ["ticker" ],
4262
+ cols = ["Date" , "type" ])
4263
+
4264
+ try :
4265
+ import openpyxl
4266
+ from openpyxl .cell import get_column_letter
4267
+ except ImportError :
4268
+ raise nose .SkipTest
4269
+
4270
+ if openpyxl .__version__ < '1.6.1' :
4271
+ raise nose .SkipTest
4272
+
4242
4273
# test xlsx_styling
4243
4274
filename = '__tmp__.xlsx'
4244
4275
pdf .to_excel (filename , 'test1' )
0 commit comments