Skip to content
Snippets Groups Projects
Commit 427d1e55 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

try to fix circelei

parent 4768749e
No related branches found
No related tags found
No related merge requests found
......@@ -44,10 +44,6 @@ jobs:
command: |
tox -e py36,pyflakes,coverage
- store_artifacts:
path: test-reports
destination: test-reports
- deploy:
name: Push coverage
command: |
......
......@@ -95,7 +95,8 @@ class Price(dict):
elif (price is not None and isinstance(price, dict) and
"base" in price and
"quote" in price):
assert "price" not in price, "You cannot provide a 'price' this way"
if "price" in price:
raise AssertionError("You cannot provide a 'price' this way")
# Regular 'price' objects according to steem-core
base_id = price["base"]["asset_id"]
if price["base"]["asset_id"] == base_id:
......@@ -257,7 +258,8 @@ class Price(dict):
else:
raise ValueError("Wrong rotation of prices")
elif isinstance(other, Amount):
assert other["asset"]["id"] == self["quote"]["asset"]["id"]
if not other["asset"]["id"] == self["quote"]["asset"]["id"]:
raise AssertionError()
a = other.copy() * self["price"]
a["asset"] = self["base"]["asset"].copy()
a["symbol"] = self["base"]["asset"]["symbol"]
......@@ -295,7 +297,8 @@ class Price(dict):
steem_instance=self.steem
)
elif isinstance(other, Amount):
assert other["asset"]["id"] == self["quote"]["asset"]["id"]
if not other["asset"]["id"] == self["quote"]["asset"]["id"]:
raise AssertionError()
a = other.copy() / self["price"]
a["asset"] = self["base"]["asset"].copy()
a["symbol"] = self["base"]["asset"]["symbol"]
......@@ -320,48 +323,60 @@ class Price(dict):
def __lt__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] < other["price"]
else:
return self["price"] < float(other or 0)
def __le__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] <= other["price"]
else:
return self["price"] <= float(other or 0)
def __eq__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] == other["price"]
else:
return self["price"] == float(other or 0)
def __ne__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] != other["price"]
else:
return self["price"] != float(other or 0)
def __ge__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] >= other["price"]
else:
return self["price"] >= float(other or 0)
def __gt__(self, other):
if isinstance(other, Price):
assert other["base"]["symbol"] == self["base"]["symbol"]
assert other["quote"]["symbol"] == self["quote"]["symbol"]
if not other["base"]["symbol"] == self["base"]["symbol"]:
raise AssertionError()
if not other["quote"]["symbol"] == self["quote"]["symbol"]:
raise AssertionError()
return self["price"] > other["price"]
else:
return self["price"] > float(other or 0)
......
......@@ -34,7 +34,7 @@ commands =
[testenv:coverage]
deps = coverage
commands =
py.test --cov-report xml:coverage.xml
py.test --cov-report xml:/home/circleci/repo/.tox/upload_coverage/coverage.xml
[testenv:upload_coverage]
deps = coverage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment