def test_display_income_comparison(mocker): mocker.patch.object( target=marketwatch_view.rich_config, attribute="USE_COLOR", new=True, ) marketwatch_view.display_income_comparison( similar=["TSLA", "GM"], timeframe="31-Dec-2020", quarter=True, export="", )
def call_income(self, other_args: List[str]): """Process income command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="income", description=""" Prints either yearly or quarterly income statement the company, and compares it against similar companies. """, ) parser.add_argument( "-q", "--quarter", action="store_true", default=False, dest="b_quarter", help="Quarter financial data flag.", ) parser.add_argument( "-t", "--timeframe", dest="s_timeframe", type=str, default=None, help="Specify yearly/quarterly timeframe. Default is last.", ) parser.add_argument( "--export", choices=["csv", "json", "xlsx"], default="", type=str, dest="export", help="Export dataframe data to csv,json,xlsx file", ) try: ns_parser = parse_known_args_and_warn(parser, other_args) if not ns_parser: return marketwatch_view.display_income_comparison( ticker=self.ticker, similar=self.similar, timeframe=ns_parser.s_timeframe, quarter=ns_parser.b_quarter, ) except Exception as e: print(e, "\n")
def call_income(self, other_args: List[str]): """Process income command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, prog="income", description=""" Prints either yearly or quarterly income statement the company, and compares it against similar companies. """, ) parser.add_argument( "-q", "--quarter", action="store_true", default=False, dest="b_quarter", help="Quarter financial data flag.", ) parser.add_argument( "-t", "--timeframe", dest="s_timeframe", type=str, default=None, help="Specify yearly/quarterly timeframe. Default is last.", ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-t") ns_parser = parse_known_args_and_warn( parser, other_args, EXPORT_ONLY_RAW_DATA_ALLOWED ) if ns_parser: marketwatch_view.display_income_comparison( similar=self.similar, timeframe=ns_parser.s_timeframe, quarter=ns_parser.b_quarter, )