From 4697efcf2602e1f9825f5a9c9e91fb34a4935fcd Mon Sep 17 00:00:00 2001 From: jmaslek Date: Sat, 19 Feb 2022 07:31:37 -0500 Subject: [PATCH] Squishy the bugs (#1391) * options screener tickers to list(set( * Fix fred rmv bug * Fix prt * Fix tests + change where list is called --- .../cryptocurrency/crypto_controller.py | 33 ++++++++++--------- .../economy/fred/fred_controller.py | 4 +-- .../stocks/options/syncretism_view.py | 2 +- .../economy/fred/test_fred_controller.py | 2 +- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/gamestonk_terminal/cryptocurrency/crypto_controller.py b/gamestonk_terminal/cryptocurrency/crypto_controller.py index daa9bd16f64..dace2f6f6d7 100644 --- a/gamestonk_terminal/cryptocurrency/crypto_controller.py +++ b/gamestonk_terminal/cryptocurrency/crypto_controller.py @@ -125,11 +125,14 @@ class CryptoController(CryptoBaseController): "Tool to check returns if loaded coin reaches provided price or other crypto market cap" "Uses CoinGecko to grab coin data (price and market cap).", ) - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument( - "--vs", help="Coin to compare with", dest="vs", type=str, default=None + parser.add_argument( + "--vs", + help="Coin to compare with", + dest="vs", + type=str, + required="-h" not in other_args, ) - group.add_argument( + parser.add_argument( "-p", "--price", help="Desired price", @@ -137,7 +140,7 @@ class CryptoController(CryptoBaseController): type=int, default=None, ) - group.add_argument( + parser.add_argument( "-t", "--top", help="Compare with top N coins", @@ -160,17 +163,17 @@ class CryptoController(CryptoBaseController): f"VS Coin '{ns_parser.vs}' not found in CoinGecko\n" ) return - pycoingecko_view.display_coin_potential_returns( - self.coin_map_df["CoinGecko"], - coin_found, - ns_parser.top, - ns_parser.price, - ) + pycoingecko_view.display_coin_potential_returns( + self.coin_map_df["CoinGecko"], + coin_found, + ns_parser.top, + ns_parser.price, + ) - else: - console.print( - "No coin selected. Use 'load' to load the coin you want to look at.\n" - ) + else: + console.print( + "No coin selected. Use 'load' to load the coin you want to look at.\n" + ) @log_start_end(log=logger) def call_chart(self, other_args): diff --git a/gamestonk_terminal/economy/fred/fred_controller.py b/gamestonk_terminal/economy/fred/fred_controller.py index 9e708c56d95..8dae6f83eaf 100644 --- a/gamestonk_terminal/economy/fred/fred_controller.py +++ b/gamestonk_terminal/economy/fred/fred_controller.py @@ -161,7 +161,7 @@ class FredController(BaseController): "-i", "--id", type=lambda x: x.lower(), - choices=self.current_series.keys(), + choices=[key.lower() for key in self.current_series], required="-h" not in other_args and "-a" not in other_args and "--all" not in other_args, @@ -187,7 +187,7 @@ class FredController(BaseController): else: self.current_series.pop(ns_parser.series_id) console.print( - f"Current Series Ids: [blue]{', '.join(self.current_series.keys()) or None}[/blue]\n" + f"Current Series Ids: [blue]{', '.join(self.current_series.keys()) .upper() or None}[/blue]\n" ) @log_start_end(log=logger) diff --git a/gamestonk_terminal/stocks/options/syncretism_view.py b/gamestonk_terminal/stocks/options/syncretism_view.py index 2fcf8253fa5..b70fa963298 100644 --- a/gamestonk_terminal/stocks/options/syncretism_view.py +++ b/gamestonk_terminal/stocks/options/syncretism_view.py @@ -97,7 +97,7 @@ def view_screener_output( ) console.print("") - return df_res["S"].values.tolist() + return list(set(df_res["S"].values.tolist())) # pylint:disable=too-many-arguments diff --git a/tests/gamestonk_terminal/economy/fred/test_fred_controller.py b/tests/gamestonk_terminal/economy/fred/test_fred_controller.py index a1a567af231..3f233bfec4e 100644 --- a/tests/gamestonk_terminal/economy/fred/test_fred_controller.py +++ b/tests/gamestonk_terminal/economy/fred/test_fred_controller.py @@ -280,7 +280,7 @@ def test_call_func( mock.assert_called_once() else: controller = fred_controller.FredController(queue=None) - controller.current_series = {"MOCK_DICT_KEY_1": "MOCK_DICT_VALUE_1"} + controller.current_series = {"mock_dict_key1": "MOCK_DICT_VALUE_1"} getattr(controller, tested_func)(other_args)