<commit_before># -*- coding: utf-8  -*-
"""
Tests for the site module.
"""
#
# (C) Pywikibot team, 2008-2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'


import pywikibot
from pywikibot.site import must_be
from tests import patch_request, unpatch_request
from tests.utils import PywikibotTestCase, unittest

mysite = None
mainpage = None
imagepage = None


class TestSiteObject(PywikibotTestCase):
    """Test cases for Site methods."""
    family = "wikipedia"
    code = "en"

    @classmethod
    def setUpClass(cls):
        global mysite, mainpage, imagepage
        mysite = pywikibot.Site(cls.code, cls.family)
        mainpage = pywikibot.Page(pywikibot.Link("Main Page", mysite))
        imagepage = next(iter(mainpage.imagelinks()))  # 1st image on main page

    def testBaseMethods(self):
        """Test cases for BaseSite methods"""<commit_msg>Fix basestring usage in site_tests<commit_after># -*- coding: utf-8  -*-
"""
Tests for the site module.
"""
#
# (C) Pywikibot team, 2008-2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'


import pywikibot
from pywikibot.site import must_be
from tests import patch_request, unpatch_request
from tests.utils import PywikibotTestCase, unittest

import sys
if sys.version_info[0] > 2:
    basestring = (str, )

mysite = None
mainpage = None
imagepage = None


class TestSiteObject(PywikibotTestCase):
    """Test cases for Site methods."""
    family = "wikipedia"
    code = "en"

    @classmethod
    def setUpClass(cls):
        global mysite, mainpage, imagepage
        mysite = pywikibot.Site(cls.code, cls.family)
        mainpage = pywikibot.Page(pywikibot.Link("Main Page", mysite))
        imagepage = next(iter(mainpage.imagelinks()))  # 1st image on main page

    def testBaseMethods(self):
        """Test cases for BaseSite methods"""
{'fraction_non_alphanumeric': 0.10986066452304394, 'fraction_numerical': 0.011789924973204717, 'mean_word_length': 3.632754342431762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3582602', 'n_tokens_mistral': 619, 'n_tokens_neox': 595, 'n_words': 176}