| Magul created this task. Magul added projects: Pywikibot-core, Pywikibot-tests. |
TASK DESCRIPTION
______________ TestSiteGenerators.test_allpages_langlinks_enabled ______________
self = <tests.site_tests.TestSiteGenerators testMethod=test_allpages_langlinks_enabled>
def test_allpages_langlinks_enabled(self):
"""Test allpages with langlinks enabled."""
mysite = self.get_site()
for page in mysite.allpages(filterlanglinks=True, total=5):
self.assertIsInstance(page, pywikibot.Page)
self.assertTrue(mysite.page_exists(page))
self.assertEqual(page.namespace(), 0)
> self.assertNotEqual(page.langlinks(), [])
tests/site_tests.py:598:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pywikibot/page.py:1440: in langlinks
self._langlinks = list(self.iterlanglinks(include_obsolete=True))
pywikibot/site.py:3967: in pagelanglinks
source=self)
pywikibot/page.py:5380: in langlinkUnsafe
link._site = pywikibot.Site(lang, source.family.name)
pywikibot/__init__.py:850: in Site
_sites[key] = interface(code=code, fam=fam, user=user, sysop=sysop)
pywikibot/site.py:1855: in __init__
BaseSite.__init__(self, code, fam, user, sysop)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = APISite("it", "wpbeta"), code = 'it', fam = Family("wpbeta"), user = None
sysop = None
def __init__(self, code, fam=None, user=None, sysop=None):
"""
Constructor.
@param code: the site's language code
@type code: str
@param fam: wiki family name (optional)
@type fam: str or Family
@param user: bot user name (optional)
@type user: str
@param sysop: sysop account user name (optional)
@type sysop: str
"""
if code.lower() != code:
# Note the Site function in __init__ also emits a UserWarning
# for this condition, showing the callers file and line no.
pywikibot.log(u'BaseSite: code "%s" converted to lowercase' % code)
code = code.lower()
if not all(x in pywikibot.family.CODE_CHARACTERS for x in str(code)):
pywikibot.log(u'BaseSite: code "%s" contains invalid characters'
% code)
self.__code = code
if isinstance(fam, basestring) or fam is None:
self.__family = pywikibot.family.Family.load(fam)
else:
self.__family = fam
self.obsolete = False
# if we got an outdated language code, use the new one instead.
if self.__code in self.__family.obsolete:
if self.__family.obsolete[self.__code] is not None:
self.__code = self.__family.obsolete[self.__code]
# Note the Site function in __init__ emits a UserWarning
# for this condition, showing the callers file and line no.
pywikibot.log(u'Site %s instantiated using code %s'
% (self, code))
else:
# no such language anymore
self.obsolete = True
pywikibot.log(u'Site %s instantiated and marked "obsolete" '
u'to prevent access' % self)
elif self.__code not in self.languages():
if self.__family.name in list(self.__family.langs.keys()) and \
len(self.__family.langs) == 1:
self.__code = self.__family.name
if self.__family == pywikibot.config.family \
and code == pywikibot.config.mylang:
pywikibot.config.mylang = self.__code
warn(u'Global configuration variable "mylang" changed to '
u'"%s" while instantiating site %s'
% (self.__code, self), UserWarning)
else:
raise UnknownSite(u"Language '%s' does not exist in family %s"
> % (self.__code, self.__family.name))
E UnknownSite: Language 'it' does not exist in family wpbeta
pywikibot/site.py:773: UnknownSiteSee: https://travis-ci.org/wikimedia/pywikibot-core/jobs/177955830#L1613-L1697
TASK DETAIL
EMAIL PREFERENCES
To: Magul
Cc: pywikibot-bugs-list, Aklapper, Magul, MayS, Mdupont, JJMC89, jayvdb, Dalba, Masti, Alchimista, Rxy
Cc: pywikibot-bugs-list, Aklapper, Magul, MayS, Mdupont, JJMC89, jayvdb, Dalba, Masti, Alchimista, Rxy
_______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
