def call_ca(self, _):
        """Process ca command"""

        from gamestonk_terminal.stocks.comparison_analysis import ca_controller

        self.queue = ca_controller.menu(
            [self.ticker] if self.ticker else "", self.queue
        )
 def call_ca(self, _):
     """Call the comparison analysis menu with selected tickers"""
     if self.screen_tickers:
         self.queue = ca_controller.menu(
             self.screen_tickers, self.queue, from_submenu=True
         )
     else:
         print("Some tickers must be screened first through one of the presets!\n")
 def call_ca(self, _):
     """Call the comparison analysis menu with selected tickers"""
     if self.tickers:
         self.queue = ca_controller.menu(self.tickers,
                                         self.queue,
                                         from_submenu=True)
     else:
         print("No main ticker loaded to go into comparison analysis menu",
               "\n")
    def call_ca(self, _):
        """Process ca command"""
        if not self.ticker:
            print("Use 'load <ticker>' prior to this command!", "\n")
            return

        ret = ca_controller.menu(self.ticker, self.start, self.interval, self.stock)

        if ret is False:
            self.print_help()
        else:
            return True
Exemple #5
0
def test_menu_with_queue(expected, from_submenu, mocker, queue):
    mocker.patch(
        target=(
            "gamestonk_terminal.stocks.comparison_analysis.ca_controller."
            "ComparisonAnalysisController.switch"
        ),
        return_value=["quit"],
    )
    result_menu = ca_controller.menu(
        similar=["MOCK_SIMILAR_1", "MOCK_SIMILAR_2"],
        queue=queue,
        from_submenu=from_submenu,
    )

    assert result_menu == expected
Exemple #6
0
def test_menu_without_queue_sys_exit(mock_input, mocker):
    # DISABLE AUTO-COMPLETION
    mocker.patch.object(
        target=ca_controller.gtff,
        attribute="USE_PROMPT_TOOLKIT",
        new=False,
    )
    mocker.patch(
        target="gamestonk_terminal.stocks.comparison_analysis.ca_controller.session",
        return_value=None,
    )

    # MOCK USER INPUT
    mocker.patch("builtins.input", return_value=mock_input)

    # MOCK SWITCH
    class SystemExitSideEffect:
        def __init__(self):
            self.first_call = True

        def __call__(self, *args, **kwargs):
            if self.first_call:
                self.first_call = False
                raise SystemExit()
            return ["quit"]

    mock_switch = mocker.Mock(side_effect=SystemExitSideEffect())
    mocker.patch(
        target=(
            "gamestonk_terminal.stocks.comparison_analysis.ca_controller."
            "ComparisonAnalysisController.switch"
        ),
        new=mock_switch,
    )

    result_menu = ca_controller.menu(
        similar=["MOCK_SIMILAR_1", "MOCK_SIMILAR_2"],
        queue=None,
        from_submenu=False,
    )

    assert result_menu == []
Exemple #7
0
def test_menu_without_queue_completion(mocker):
    # DISABLE AUTO-COMPLETION
    mocker.patch.object(
        target=ca_controller.gtff,
        attribute="USE_PROMPT_TOOLKIT",
        new=True,
    )
    mocker.patch(
        target="gamestonk_terminal.stocks.comparison_analysis.ca_controller.session",
    )
    mocker.patch(
        target="gamestonk_terminal.stocks.comparison_analysis.ca_controller.session.prompt",
        return_value="quit",
    )

    result_menu = ca_controller.menu(
        similar=["MOCK_SIMILAR_1", "MOCK_SIMILAR_2"],
        queue=None,
        from_submenu=False,
    )

    assert result_menu == []
 def call_ca(self, _):
     """Process ca command"""
     if len(self.etf_holdings) > 0:
         self.queue = ca_controller.menu(self.etf_holdings,
                                         self.queue,
                                         from_submenu=True)