<commit_before># -*- coding: utf-8  -*-
"""
Test aspects to allow fine grained control over what tests are executed.

Several parts of the test infrastructure are implemented as mixins,
such as API result caching and excessive test durations.  An unused
mixin to show cache usage is included.
"""
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import print_function
__version__ = '$Id$'
"""
    TODO:

        skip if the user is blocked.
        sysop flag, implement in site & page, and
            possibly some of the script tests.
        labs flag, for wikidataquery
        slow flag
            wikiquerydata - quite slow
            weblib - also slow
            (this class, and a FastTest, could error/pass based
             it consumed more than a specified amount of time allowed.)
        net flag should disable network libraries
        UITestCase:
            Not integrated; direct subclass of unittest.TestCase.
"""
import time
import sys
import os
import inspect

import pywikibot

from pywikibot import config, log, Site
from pywikibot.site import BaseSite
from pywikibot.family import WikimediaFamily
from pywikibot.data.api import Request as _original_Request

import tests
from tests import unittest, patch_request, unpatch_request


class TestCaseBase(unittest.TestCase):

    """Base class for all tests."""

    if sys.version_info[0] == 2:
        def assertRaisesRegex(self, *args, **kwargs):
            """
            Wrapper of unittest.assertRaisesRegexp for Python 2 unittest.

            assertRaisesRegexp is deprecated in Python 3.
            """
            return self.assertRaisesRegexp(*args, **kwargs)

        def assertRegex(self, *args, **kwargs):
            """<commit_msg>[IMPROV] TestBaseCase: Only add backward compatible aliases if needed<commit_after># -*- coding: utf-8  -*-
"""
Test aspects to allow fine grained control over what tests are executed.

Several parts of the test infrastructure are implemented as mixins,
such as API result caching and excessive test durations.  An unused
mixin to show cache usage is included.
"""
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import print_function
__version__ = '$Id$'
"""
    TODO:

        skip if the user is blocked.
        sysop flag, implement in site & page, and
            possibly some of the script tests.
        labs flag, for wikidataquery
        slow flag
            wikiquerydata - quite slow
            weblib - also slow
            (this class, and a FastTest, could error/pass based
             it consumed more than a specified amount of time allowed.)
        net flag should disable network libraries
        UITestCase:
            Not integrated; direct subclass of unittest.TestCase.
"""
import time
import sys
import os
import inspect

import pywikibot

from pywikibot import config, log, Site
from pywikibot.site import BaseSite
from pywikibot.family import WikimediaFamily
from pywikibot.data.api import Request as _original_Request

import tests
from tests import unittest, patch_request, unpatch_request


class TestCaseBase(unittest.TestCase):

    """Base class for all tests."""

    if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
        def assertRaisesRegex(self, *args, **kwargs):
            """
            Wrapper of unittest.assertRaisesRegexp for Python 2 unittest.

            assertRaisesRegexp is deprecated in Python 3.
            """
            return self.assertRaisesRegexp(*args, **kwargs)

    if not hasattr(unittest.TestCase, 'assertRegex'):
        def assertRegex(self, *args, **kwargs):
            """
{'fraction_non_alphanumeric': 0.06854510972636142, 'fraction_numerical': 0.004334868599295584, 'mean_word_length': 2.806185567010309, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '183290', 'n_tokens_mistral': 1004, 'n_tokens_neox': 961, 'n_words': 405}