]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/Cryptoportfolio/Trader.git/commitdiff
Don’t raise when some market is disabled
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 26 Sep 2018 09:51:14 +0000 (11:51 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Wed, 26 Sep 2018 09:51:14 +0000 (11:51 +0200)
portfolio.py
tests/test_portfolio.py

index 94472a3636de776d0724c6484fd7dbd85c406566..1d291069bfa08c7cb497e90046de010e6d7f2e02 100644 (file)
@@ -52,7 +52,7 @@ class Amount:
                     ticker=asset_ticker,
                     rate=rate)
         else:
-            raise Exception("This asset is not available in the chosen market")
+            return Amount(other_currency, 0, linked_to=self, ticker=None, rate=0)
 
     def as_json(self):
         return {
index d4e5ab93ea31b41a6c6c941122cffac374395e9d..cad3095a34eb2bfd0f42ef1b398d6ad878b86a6c 100644 (file)
@@ -1856,7 +1856,7 @@ class AmountTest(WebMockTestCase):
         with self.subTest(desc="no ticker for currency"):
             self.m.get_ticker.return_value = None
 
-            self.assertRaises(Exception, amount.in_currency, "ETH", self.m)
+            self.assertEqual(portfolio.Amount("ETH", 0), amount.in_currency("ETH", self.m))
 
         with self.subTest(desc="nominal case"):
             self.m.get_ticker.return_value = {