Skip to content

Commit a323cc9

Browse files
committed
Merge pull request #6117 from jmcnamara/tst_excel_read_xlsm
TST: Add xlsm to Excel parsing tests.
2 parents 50a0cac + 6b39800 commit a323cc9

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

pandas/io/tests/data/test.xlsm

44 KB
Binary file not shown.

pandas/io/tests/test_excel.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ def test_parse_cols_int(self):
9090
_skip_if_no_openpyxl()
9191
_skip_if_no_xlrd()
9292

93-
suffix = ['', 'x']
93+
suffix = ['xls', 'xlsx', 'xlsm']
9494

9595
for s in suffix:
96-
pth = os.path.join(self.dirpath, 'test.xls%s' % s)
96+
pth = os.path.join(self.dirpath, 'test.%s' % s)
9797
xls = ExcelFile(pth)
9898
df = xls.parse('Sheet1', index_col=0, parse_dates=True,
9999
parse_cols=3)
@@ -109,10 +109,10 @@ def test_parse_cols_list(self):
109109
_skip_if_no_openpyxl()
110110
_skip_if_no_xlrd()
111111

112-
suffix = ['', 'x']
112+
suffix = ['xls', 'xlsx', 'xlsm']
113113

114114
for s in suffix:
115-
pth = os.path.join(self.dirpath, 'test.xls%s' % s)
115+
pth = os.path.join(self.dirpath, 'test.%s' % s)
116116
xls = ExcelFile(pth)
117117
df = xls.parse('Sheet1', index_col=0, parse_dates=True,
118118
parse_cols=[0, 2, 3])
@@ -129,11 +129,11 @@ def test_parse_cols_str(self):
129129
_skip_if_no_openpyxl()
130130
_skip_if_no_xlrd()
131131

132-
suffix = ['', 'x']
132+
suffix = ['xls', 'xlsx', 'xlsm']
133133

134134
for s in suffix:
135135

136-
pth = os.path.join(self.dirpath, 'test.xls%s' % s)
136+
pth = os.path.join(self.dirpath, 'test.%s' % s)
137137
xls = ExcelFile(pth)
138138

139139
df = xls.parse('Sheet1', index_col=0, parse_dates=True,
@@ -678,26 +678,26 @@ def test_excel_date_datetime_format(self):
678678
with ensure_clean(self.ext) as filename1:
679679
with ensure_clean(self.ext) as filename2:
680680
writer1 = ExcelWriter(filename1)
681-
writer2 = ExcelWriter(filename2,
681+
writer2 = ExcelWriter(filename2,
682682
date_format='DD.MM.YYYY',
683683
datetime_format='DD.MM.YYYY HH-MM-SS')
684684

685685
df.to_excel(writer1, 'test1')
686686
df.to_excel(writer2, 'test1')
687-
687+
688688
writer1.close()
689689
writer2.close()
690690

691691
reader1 = ExcelFile(filename1)
692692
reader2 = ExcelFile(filename2)
693-
693+
694694
rs1 = reader1.parse('test1', index_col=None)
695695
rs2 = reader2.parse('test1', index_col=None)
696-
696+
697697
tm.assert_frame_equal(rs1, rs2)
698698

699699
# since the reader returns a datetime object for dates, we need
700-
# to use df_expected to check the result
700+
# to use df_expected to check the result
701701
tm.assert_frame_equal(rs2, df_expected)
702702

703703
def test_to_excel_periodindex(self):

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,7 @@ def pxd(name):
567567
'tests/data/*.txt',
568568
'tests/data/*.xls',
569569
'tests/data/*.xlsx',
570+
'tests/data/*.xlsm',
570571
'tests/data/*.table',
571572
'tests/data/*.html',
572573
'tests/test_json/data/*.json'],

0 commit comments

Comments
 (0)