jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] Data: Use site's language and not code ......................................................................
[FIX] Data: Use site's language and not code
Previously date.py was using the site's code which is not always the same as the language, especially when they are projects which don't have extra sites for the different languages. This is now using the site's language.
To get the site's language a siteinfo request must be done so the two tests which were failing previously must be now non-dry tests.
Bug: T85645 Change-Id: I8b7efd0cdd2ef5fa65ab57c2f47415932cb7d34b --- M pywikibot/date.py M tests/pagegenerators_tests.py 2 files changed, 1 insertion(+), 11 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/date.py b/pywikibot/date.py index 0fcaa0e..36dc254 100644 --- a/pywikibot/date.py +++ b/pywikibot/date.py @@ -2334,7 +2334,7 @@ self.site = site
def __call__(self, m, d): - return formats['Day_' + enMonthNames[m-1]][self.site.code](d) + return formats['Day_' + enMonthNames[m-1]][self.site.lang](d)
def formatYear(lang, year): diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py index 3c4e632..4cc227c 100755 --- a/tests/pagegenerators_tests.py +++ b/tests/pagegenerators_tests.py @@ -283,13 +283,8 @@
"""Test the year page generator."""
- dry = True - def test_basic(self): site = self.get_site() - # Skip if its wikidata because T85645 - if site.family == "wikidata": - raise unittest.SkipTest('date.py does not support wikidata') # Some languages are missing (T85681) if (site.language() not in date.formats['YearBC']) or (site.language() not in date.formats['YearAD']): raise unittest.SkipTest('Date formats for this language are missing from date.py') @@ -311,13 +306,8 @@
"""Test the day page generator."""
- dry = True - def test_basic(self): site = self.get_site() - # Skip if its wikidata because T85645 - if site.family == "wikidata": - raise unittest.SkipTest fd = date.FormatDate(site) startMonth = 1 endMonth = 12