コード例 #1
0
    def test_main_no_generator_found(self):
        """Invoke main when our generator_factory can't provide a generator."""
        main('-text:hello')

        self.assertEqual([
            'Unable to execute script because no generator was defined.\n'
            'Use -help for further information.'
        ], pywikibot.bot.ui.pop_output())
コード例 #2
0
    def test_main_no_arguments(self):
        """Invoke our main method without any arguments."""
        main()

        self.assertEqual([
            "Either the '-text' or '-textfile' is required\n"
            'Use -help for further information.'
        ], pywikibot.bot.ui.pop_output())
コード例 #3
0
    def test_main_unrecognized_argument(self):
        """Invoke our main method with an invalid argument."""
        main('no_such_arg')

        self.assertEqual([
            "Argument 'no_such_arg' is unrecognized\n"
            'Use -help for further information.',
        ], pywikibot.bot.ui.pop_output())