Files
@ 110c68468203
Branch filter:
Location: rattail-project/rattail/tests/test_excel.py - annotation
110c68468203
1.1 KiB
text/x-python
Update changelog
1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 1ac0139fd378 | # -*- coding: utf-8; -*-
from __future__ import unicode_literals, absolute_import
import os
from unittest import TestCase
import openpyxl
from rattail import excel as mod
from rattail.config import make_config
class TestExcelReaderXLSX(TestCase):
def setUp(self):
self.config = self.make_config()
def make_config(self):
return make_config([], extend=False)
def test_strip_fieldnames(self):
app = self.config.get_app()
path = app.make_temp_file(suffix='.xlsx')
# first make a workbook which has whitespace in column headers
workbook = openpyxl.Workbook()
sheet = workbook.active
sheet.append([' first ', 'second '])
workbook.save(path)
# reader should strip fieldnames by default
reader = mod.ExcelReaderXLSX(path)
self.assertEqual(reader.fields, ['first', 'second'])
# unless we say not to strip them
reader = mod.ExcelReaderXLSX(path, strip_fieldnames=False)
self.assertEqual(reader.fields, [' first ', 'second '])
os.remove(path)
|