Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: pyexcel-ods3
organisation: pyexcel
releases:
- changes:
- action: added
details:
- '`#36`: fixing get_data for a currency cell with no currency defined'
date: 10.7.2024
version: 0.6.2
- changes:
- action: added
details:
Expand Down
5 changes: 4 additions & 1 deletion pyexcel_ods3/odsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def cell_value(self, row, column):
if service.has_no_digits_in_float(cell_value):
cell_value = int(cell_value)

ret = str(cell_value) + " " + cell.currency
if cell.currency is None:
ret = str(cell_value)
else:
ret = str(cell_value) + " " + cell.currency
elif cell_type in service.ODS_FORMAT_CONVERSION:
value = cell.value
n_value = service.VALUE_CONVERTERS[cell_type](value)
Expand Down
Binary file added tests/fixtures/currency_without_currency.ods
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/test_bug_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,15 @@ def test_issue_30_precision_loss():
sheet.save_as(test_file)


def test_issue_36():
from pyexcel_ods3 import get_data

test_file = "currency_without_currency.ods"
data = get_data(get_fixtures(test_file))
eq_(data["Sheet1"][6][0], '1.75"')
eq_(data["Sheet1"][6][5], "95")
eq_(data["Sheet1"][6][6], 25)


def get_fixtures(filename):
return os.path.join("tests", "fixtures", filename)