make an exception when integer precision loss happens. resolve #30

This commit is contained in:
chfw 2018-11-26 07:50:08 +00:00
parent 9839d93a07
commit 60aea378ae
2 changed files with 23 additions and 4 deletions

View File

@ -1,11 +1,11 @@
overrides: "pyexcel.yaml"
name: "pyexcel-ods"
nick_name: ods
version: 0.5.3
current_version: 0.5.3
version: 0.5.4
current_version: 0.5.4
release: 0.5.3
file_type: ods
dependencies:
- pyexcel-io>=0.5.3
- pyexcel-io>=0.5.9
- odfpy==1.3.5
description: A wrapper library to read, manipulate and write data in ods format

View File

@ -4,6 +4,7 @@ import os
import psutil
import pyexcel as pe
from pyexcel_ods import get_data, save_data
from pyexcel_io.exceptions import IntegerAccuracyLossError
from nose.tools import raises, eq_
from nose import SkipTest
@ -125,7 +126,7 @@ def test_pr_22():
def test_issue_23():
if not IN_TRAVIS:
raise SkipTest()
pe.get_book(url="https://github.com/pyexcel/pyexcel-ods/raw/master/tests/fixtures/white_space.ods"); # flake8: noqa
pe.get_book(url="https://github.com/pyexcel/pyexcel-ods/raw/master/tests/fixtures/white_space.ods") # noqa: E501
def test_issue_24():
@ -140,5 +141,23 @@ def test_issue_27():
eq_(data['VGPMX'], [['', 'Cost Basis', '0']])
def test_issue_30():
test_file = "issue_30.ods"
sheet = pe.Sheet()
sheet[0, 0] = 999999999999999
sheet.save_as(test_file)
sheet2 = pe.get_sheet(file_name=test_file)
eq_(sheet[0, 0], sheet2[0, 0])
os.unlink(test_file)
@raises(IntegerAccuracyLossError)
def test_issue_30_precision_loss():
test_file = "issue_30_2.ods"
sheet = pe.Sheet()
sheet[0, 0] = 9999999999999999
sheet.save_as(test_file)
def get_fixtures(filename):
return os.path.join("tests", "fixtures", filename)