Bugfix: Interpret '1E' as a string, not a numeric.
Created originally on Bitbucket by hjunes (Heikki Junes)
The content attached hg bundle is shown below:
{{{ #!python
=== (+2,-2) openpyxl/cell.py === @@ -162,7 +162,7 @@ RE_PATTERNS = { 'percentage': re.compile('^-?[0-9].?[0-9]\s?%$'), 'time': re.compile('^(\d|[0-1]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$'),
-
'numeric': re.compile('^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+|[0-9]+\\.?[0-9]*(E|e)\-?[0-9]*|[0-9]*\\.?[0-9]+(E|e)\-?[0-9])$'), }
-
'numeric': re.compile('^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)((E|e)\-?[0-9]+)?$'), }
def init(self, worksheet, column, row, value = None): self.column = column.upper()
=== (+15,-1) openpyxl/tests/test_cell.py === @@ -139,6 +139,20 @@ yield check_error
+def test_data_type_check():
- cell = Cell(None, 'A', 1)
- cell.bind_value(None)
- eq_(Cell.TYPE_NULL, cell._data_type)
- cell.bind_value('.0e000')
- eq_(Cell.TYPE_NUMERIC, cell._data_type)
- cell.bind_value('-0.e-0')
- eq_(Cell.TYPE_NUMERIC, cell._data_type)
- cell.bind_value('1E')
- eq_(Cell.TYPE_STRING, cell._data_type)
@raises(DataTypeException) def test_set_bad_type(): cell = Cell(None, 'A', 1)
}}}
Attachments: changes2.bundle