def test_rating_over_time_invalid_token(): finnhub_view.rating_over_time( ticker="TSLA", num=10, raw=False, export=None, )
def test_rating_over_time_invalid_ticker(): finnhub_view.rating_over_time( ticker="INVALID_TICKER", num=10, raw=False, export=None, )
def test_rating_over_time(): finnhub_view.rating_over_time( ticker="TSLA", num=10, raw=True, export=None, )
def test_rating_over_time_invalid_token(mocker): # MOCK VISUALIZE_OUTPUT mocker.patch( target= "gamestonk_terminal.helper_classes.TerminalStyle.visualize_output") finnhub_view.rating_over_time( ticker="TSLA", num=10, raw=False, export=None, )
def test_rating_over_time_plt(capsys, mocker): mock_show = mocker.Mock() mocker.patch(target="matplotlib.pyplot.show", new=mock_show) finnhub_view.rating_over_time( ticker="TSLA", num=10, raw=False, export=None, ) capsys.readouterr() mock_show.assert_called_once()
def call_rot(self, other_args: List[str]): """Process rot command""" parser = argparse.ArgumentParser( add_help=False, prog="rot", description=""" Rating over time (monthly). [Source: Finnhub] """, ) parser.add_argument( "-n", "--num", action="store", dest="n_num", type=check_positive, default=10, help="number of last months", ) parser.add_argument( "--raw", action="store_true", dest="raw", help="Only output raw data", ) parser.add_argument( "--export", choices=["csv", "json", "xlsx"], default="", type=str, dest="export", help="Export dataframe data to csv,json,xlsx file", ) try: if other_args: if "-" not in other_args[0]: other_args.insert(0, "-n") ns_parser = parse_known_args_and_warn(parser, other_args) if not ns_parser: return finnhub_view.rating_over_time( ticker=self.ticker, num=ns_parser.n_num, raw=ns_parser.raw, export=ns_parser.export, ) except Exception as e: print(e, "\n")
def call_rot(self, other_args: List[str]): """Process rot command""" parser = argparse.ArgumentParser( add_help=False, prog="rot", description=""" Rating over time (monthly). [Source: Finnhub] """, ) parser.add_argument( "-l", "--limit", action="store", dest="limit", type=check_positive, default=10, help="Limit of last months", ) parser.add_argument( "--raw", action="store_true", dest="raw", help="Only output raw data", ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-l") ns_parser = parse_known_args_and_warn( parser, other_args, EXPORT_BOTH_RAW_DATA_AND_FIGURES ) if ns_parser: finnhub_view.rating_over_time( ticker=self.ticker, num=ns_parser.limit, raw=ns_parser.raw, export=ns_parser.export, )