-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD converting proto standing value msg. to float
- Adds method for converting protobuf standing value message to float.
- Loading branch information
1 parent
3b4d959
commit 9828961
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
"""Helpers for evaluating standing.""" | ||
|
||
|
||
def read_standing_from_proto(standing_proto): | ||
"""Convert protobuf standing value message to float.""" | ||
|
||
return standing_proto.units + (standing_proto.nanos * (10**-9)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,24 @@ | |
from setuptools import setup, find_packages | ||
from setuphelpers import long_description, git_version, test_command | ||
|
||
|
||
setup( | ||
name="eve-glue", | ||
version="{}{}".format(git_version(), os.getenv( | ||
"PACKAGE_VERSION_SUFFIX", "")), | ||
version="{}{}".format(git_version(), os.getenv("PACKAGE_VERSION_SUFFIX", | ||
"")), | ||
description="eve-glue", | ||
long_description=long_description(), | ||
cmdclass=test_command(cover="eve_glue"), | ||
packages=find_packages(), | ||
author="Team Tech Co", | ||
author_email="[email protected]", | ||
url="https://github.com/ccpgames/eve-glue", | ||
dependency_links=[ | ||
'https://pypi.evetech.net/pypi/eveproto', | ||
], | ||
setup_requires=["setuphelpers"], | ||
tests_require=[ | ||
'eveproto>=0.1.80', | ||
], | ||
classifiers=[ | ||
"Development Status :: 3 - Alpha", | ||
"Environment :: Web Environment", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Pytests for the eve_glue module standing.""" | ||
|
||
from eve_glue import standing | ||
from eve.standing.standing_pb2 import Value as StandingValue | ||
|
||
|
||
def test_read_standing_from_proto(): | ||
"""Test read standing from proto.""" | ||
|
||
assert standing.read_standing_from_proto( | ||
StandingValue(units=2, nanos=232543000)) == 2.232543 | ||
assert standing.read_standing_from_proto( | ||
StandingValue(units=-2, nanos=-131200000)) == -2.1312 | ||
assert standing.read_standing_from_proto( | ||
StandingValue(units=0, nanos=-131200000)) == -0.1312 | ||
assert standing.read_standing_from_proto( | ||
StandingValue(units=0, nanos=131200000)) == 0.1312 | ||
assert standing.read_standing_from_proto(StandingValue(units=0, | ||
nanos=0)) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters