Commit 17744e53 authored by CharlieC's avatar CharlieC
Browse files

Empty cells should contain None but findtext() returns an empty string. :-/

--HG--
branch : 2.6
parent 30dfb45759ac
......@@ -177,7 +177,7 @@ class WorkSheetParser(object):
if data_type == "inlineStr":
value = None
else:
value = element.findtext(VALUE_TAG)
value = element.findtext(VALUE_TAG, None) or None
if coordinate:
row, column = coordinate_to_tuple(coordinate)
......
......@@ -257,6 +257,20 @@ class TestWorksheetParser:
'style_id':0, 'value': 1}
def test_empty_cell(self, WorkSheetParser):
parser = WorkSheetParser
src = """
<c r="A1" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<v />
</c>
"""
element = fromstring(src)
cell = parser.parse_cell(element)
assert cell == {'column': 1, 'data_type': 'n', 'row': 1,
'style_id':0, 'value': None}
def test_datetime(self, WorkSheetParser):
parser = WorkSheetParser
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment