diff --git a/.circleci/config.yml b/.circleci/config.yml index afd1372b2ed3bd201cfce555b1b0fa11bf73209c..e63c3f99e6ec36dd6ea3f2294018deb64d8a7d7e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,10 +44,6 @@ jobs: command: | tox -e py36,pyflakes,coverage - - store_artifacts: - path: test-reports - destination: test-reports - - deploy: name: Push coverage command: | diff --git a/beem/price.py b/beem/price.py index c38db4d3301bc70439ffbdc5c357ca6ec88e244d..0e8b951293f6feaa67b11815ed5dd74574981eac 100644 --- a/beem/price.py +++ b/beem/price.py @@ -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) diff --git a/tox.ini b/tox.ini index 2d5a71d6d16e069bdb5afdf58aafb7da2a2fdd06..4160dff88c1277c44a29c6a9a61d8ca89fa615bd 100644 --- a/tox.ini +++ b/tox.ini @@ -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