def _run_command_compare_to_string(self, command, exit_status,
                                       stdout_text=None, stderr_text=None):
        """
            Compares stdout from the CLI to the given string
        """
        try:
            main.parse_and_validate_commands(command)
        except __HOLE__ as e:
            self.assertEqual(e.code, exit_status)

        if stdout_text is not None:
            actual = self.test_stdout.getvalue()
            self.assertEqual(stdout_text, actual,
                             self._format_expected_actual(stdout_text, actual))

        if stderr_text is not None:
            actual = self.test_stderr.getvalue()
            self.assertEqual(stderr_text, self.test_stderr.getvalue(),
                             self._format_expected_actual(stderr_text, actual))
dataset/ETHPy150Open prestodb/presto-admin/tests/unit/test_main.py/BaseMainCase._run_command_compare_to_string