Fix floorfloat, and pep8 fixes for tests

This commit is contained in:
Ebag333
2017-02-21 07:38:32 -08:00
parent cdbf4cf5ec
commit 565a78610e
4 changed files with 8 additions and 12 deletions

View File

@@ -17,15 +17,9 @@
# along with eos. If not, see <http://www.gnu.org/licenses/>.
# ===============================================================================
import decimal
from math import floor
def floorFloat(value):
"""Round float down to integer"""
# We have to convert float to str to keep compatibility with
# decimal module in python 2.6
value = str(value)
# Do the conversions for proper rounding down, avoiding float
# representation errors
result = int(decimal.Decimal(value).to_integral_value(rounding=decimal.ROUND_DOWN))
result = int(floor(value))
return result

View File

@@ -1,5 +1,6 @@
from gui.aboutData import versionString, licenses, developers, credits, description
def test_aboutData():
assert versionString.__len__() > 0
assert licenses.__len__() > 0

View File

@@ -1,5 +1,6 @@
from service.attribute import Attribute
def test_attribute():
"""
We don't really have much to test here, to throw a generic attribute at it and validate we get the expected results
@@ -19,13 +20,13 @@ def test_attribute():
assert type(info.description) is unicode
assert info.displayName == 'Optimal Range'
assert type(info.displayName) is unicode
assert info.highIsGood == True
assert info.highIsGood is True
assert type(info.highIsGood) is bool
assert info.iconID == 1391
assert type(info.iconID) is int
assert info.name == 'maxRange'
assert type(info.name) is unicode
assert info.published == True
assert info.published is True
assert type(info.published) is bool
assert info.unitID == 1
assert type(info.unitID) is int

View File

@@ -2,10 +2,10 @@
import os
import sys
import importlib
# import importlib
# noinspection PyPackageRequirements
import pytest
# import pytest
script_dir = os.path.dirname(os.path.abspath(__file__))