aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-12 02:13:17 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-02-12 09:02:13 +0100
commitf320eb8aafbceafbbfca02617db4846b3571e598 (patch)
tree288b8f5cda4264fc6e0c889de2c77848bf706c9a /test.py
parent0c79fad318711394874d94672e96db6da1ed9c52 (diff)
downloadTrader-f320eb8aafbceafbbfca02617db4846b3571e598.tar.gz
Trader-f320eb8aafbceafbbfca02617db4846b3571e598.tar.zst
Trader-f320eb8aafbceafbbfca02617db4846b3571e598.zip
Add missing amount operations
Diffstat (limited to 'test.py')
-rw-r--r--test.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test.py b/test.py
index 1965521..c496e11 100644
--- a/test.py
+++ b/test.py
@@ -220,6 +220,8 @@ class AmountTest(WebMockTestCase):
220 amount4 = portfolio.Amount("ETH", 0.0) 220 amount4 = portfolio.Amount("ETH", 0.0)
221 self.assertEqual(amount1, amount1 + amount4) 221 self.assertEqual(amount1, amount1 + amount4)
222 222
223 self.assertEqual(amount1, amount1 + 0)
224
223 def test__radd(self): 225 def test__radd(self):
224 amount = portfolio.Amount("XVG", "12.9") 226 amount = portfolio.Amount("XVG", "12.9")
225 227
@@ -241,6 +243,13 @@ class AmountTest(WebMockTestCase):
241 amount4 = portfolio.Amount("ETH", 0.0) 243 amount4 = portfolio.Amount("ETH", 0.0)
242 self.assertEqual(amount1, amount1 - amount4) 244 self.assertEqual(amount1, amount1 - amount4)
243 245
246 def test__rsub(self):
247 amount = portfolio.Amount("ETH", "1.6")
248 with self.assertRaises(Exception):
249 3 - amount
250
251 self.assertEqual(portfolio.Amount("ETH", "-1.6"), -amount)
252
244 def test__mul(self): 253 def test__mul(self):
245 amount = portfolio.Amount("XEM", 11) 254 amount = portfolio.Amount("XEM", 11)
246 255