Beispiel #1
0
 def setUpClass(cls):
     """Verify that the test translations are not empty."""
     if not isinstance(cls.message_package, StringTypes):
         raise TypeError('{0!s}.message_package must be a package name'.format(cls.__name__))
     # The call to set_messages_package below exists only to confirm
     # that the package exists and messages are available, so
     # that tests can be skipped if the i18n data doesnt exist.
     cls.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(cls.message_package)
     has_messages = i18n.messages_available()
     i18n._messages_package_name = cls.orig_messages_package_name
     if not has_messages:
         raise unittest.SkipTest("i18n messages package '{0!s}' not available.".format(cls.message_package))
     super(TWNTestCaseBase, cls).setUpClass()
Beispiel #2
0
 def setUpClass(cls):
     if not isinstance(cls.message_package, basestring):
         raise TypeError('%s.message_package must be a package name'
                         % cls.__name__)
     # Th call to set_messages_package below exists only to confirm
     # that the package exists and messages are available, so
     # that tests can be skipped if the i18n data doesnt exist.
     cls.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(cls.message_package)
     has_messages = i18n.messages_available()
     i18n._messages_package_name = cls.orig_messages_package_name
     if not has_messages:
         raise unittest.SkipTest("i18n messages package '%s' not available."
                                 % cls.message_package)
     super(TWNTestCaseBase, cls).setUpClass()
Beispiel #3
0
 def setUpClass(cls):
     """Verify that the test translations are not empty."""
     if not isinstance(cls.message_package, StringTypes):
         raise TypeError('{}.message_package must be a package name'
                         .format(cls.__name__))
     # The call to set_messages_package below exists only to confirm
     # that the package exists and messages are available, so
     # that tests can be skipped if the i18n data doesnt exist.
     cls.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(cls.message_package)
     has_messages = i18n.messages_available()
     i18n._messages_package_name = cls.orig_messages_package_name
     if not has_messages:
         raise unittest.SkipTest("i18n messages package '{}' not available."
                                 .format(cls.message_package))
     super(TWNTestCaseBase, cls).setUpClass()
Beispiel #4
0
 def tearDown(self):
     super(TWNSetMessagePackageBase, self).tearDown()
     i18n.set_messages_package(self.orig_messages_package_name)
Beispiel #5
0
 def setUp(self):
     self.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(self.message_package)
     super(TWNSetMessagePackageBase, self).setUp()
Beispiel #6
0
 def tearDown(self):
     """Load the original translations back."""
     super().tearDown()
     i18n.set_messages_package(self.orig_messages_package_name)
Beispiel #7
0
 def setUp(self):
     """Load the test translations."""
     self.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(self.message_package)
     super().setUp()
 def tearDown(self):
     """Load the original translations back."""
     super(TWNSetMessagePackageBase, self).tearDown()
     i18n.set_messages_package(self.orig_messages_package_name)
 def setUp(self):
     """Load the test translations."""
     self.orig_messages_package_name = i18n._messages_package_name
     i18n.set_messages_package(self.message_package)
     super(TWNSetMessagePackageBase, self).setUp()
Beispiel #10
0
# (C) Pywikibot team, 2004-2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id: 2fa2c83f1e1844306d977aa65ee39cd637e03f34 $'
#

import re
import datetime
import pywikibot
from pywikibot import i18n, xmlreader, Bot

from bot.utils import swwsite


i18n.set_messages_package('bot.core.i18n')


class RedirectGenerator:

    """Redirect generator."""

    def __init__(self, xmlFilename=None, namespaces=[], offset=-1,
                 use_move_log=False, use_api=False, start=None, until=None,
                 number=None, step=None, page_title=None):
        self.site = swwsite
        self.xmlFilename = xmlFilename
        self.namespaces = namespaces
        if use_api and not self.namespaces:
            self.namespaces = [0]
        self.offset = offset