jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/516273 )
Change subject: [IMPR] make Family.langs property more robust
......................................................................
[IMPR] make Family.langs property more robust
Don't include closed wikis to family files with wikimedia_sites.py.
code is used as a local variable but assigning to cls.codes
may cause side effects and cls.codes could be be overwritten.
Use a copy of cls.codes instead.
Bug: T226934
Change-Id: I97e3ad1f9214e29927b4ed4d952a65eefcb68d10
---
M pywikibot/family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Zhuyifei1999: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 1ef3d45..27a1d64 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -1568,7 +1568,7 @@
@classproperty
def langs(cls):
"""Property listing family languages."""
- codes = cls.codes
+ codes = cls.codes[:]
if hasattr(cls, 'test_codes'):
codes += cls.test_codes
--
To view, visit https://gerrit.wikimedia.org/r/516273
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I97e3ad1f9214e29927b4ed4d952a65eefcb68d10
Gerrit-Change-Number: 516273
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Lokal Profil <andre.costa(a)wikimedia.se>
Gerrit-Reviewer: Zhuyifei1999 <zhuyifei1999(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/517949 )
Change subject: Fix doc warning introduced in 06ae757533b
......................................................................
Fix doc warning introduced in 06ae757533b
Change-Id: I8f312d901be0aa30bf3fa03396d4e63876298525
---
M scripts/coordinate_import.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/coordinate_import.py b/scripts/coordinate_import.py
index 010e770..732ec11 100755
--- a/scripts/coordinate_import.py
+++ b/scripts/coordinate_import.py
@@ -125,7 +125,7 @@
Try import coordinate from the given page to the given item.
@return: whether any coordinates were found and the import
- was successful
+ was successful
@rtype: bool
"""
coordinate = page.coordinates(primary_only=True)
--
To view, visit https://gerrit.wikimedia.org/r/517949
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8f312d901be0aa30bf3fa03396d4e63876298525
Gerrit-Change-Number: 517949
Gerrit-PatchSet: 3
Gerrit-Owner: Dvorapa <dvorapa(a)seznam.cz>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/517756 )
Change subject: proofreadpage_tests.py: fix failing OCR-tests
......................................................................
proofreadpage_tests.py: fix failing OCR-tests
Text returned by OCR agorithm seems not determistic (e.g. one
possible reason might be that OCR tools used by such services
are updated and have better performances).
Test for text similarity instead of perfect text equality.
This is acceptabe as purpose of the test is to test the call to
OCR tools API, rather than the OCR process itself.
Bug: T225595
Change-Id: I500ddc6e76e0b5d4032b0f7a79e1632a9b5b3b24
---
M tests/proofreadpage_tests.py
1 file changed, 13 insertions(+), 8 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py
index efa1518..282b6a7 100644
--- a/tests/proofreadpage_tests.py
+++ b/tests/proofreadpage_tests.py
@@ -7,6 +7,7 @@
#
from __future__ import absolute_import, division, unicode_literals
+import difflib
import json
import pywikibot
@@ -335,10 +336,10 @@
'year 1872,\nBY D. APPLETON & CO.,\nIn the Office '
'of the Librarian of Congress, at '
'Washington.\n\n'),
- 'ocr': (False, 'lam-mam, according to Act of Congress, in the '
- 'year 157-2,\nBY D. APPLEION Av CO.,\nIn the '
- 'Of\ufb01ce or the Librarian of '
- 'Congress, at Washington.\n\n'),
+ 'ocr': (False, 'EsTEnen, according to Act of Congress, in the '
+ 'year 1872,\nBy D. APPLETON & CO.,\nIn the '
+ 'Office of the Librarian of Congress, at '
+ 'Washington.\n\u000c'),
'googleOCR': (False, 'ENTERED, according to Act of Congress, in '
'the year 1572,\nBY D. APPLETON & CO.\n'
'In the Office of the Librarian of '
@@ -363,7 +364,8 @@
self.skipTest(text)
ref_error, ref_text = self.data['hocr']
self.assertEqual(error, ref_error)
- self.assertEqual(text, ref_text)
+ s = difflib.SequenceMatcher(None, text, ref_text)
+ self.assertGreater(s.ratio(), 0.9)
def test_do_ocr_phetools(self):
"""Test page._do_ocr(ocr_tool='phetools')."""
@@ -372,7 +374,8 @@
if error:
self.skipTest(text)
self.assertEqual(error, ref_error)
- self.assertEqual(text, ref_text)
+ s = difflib.SequenceMatcher(None, text, ref_text)
+ self.assertGreater(s.ratio(), 0.9)
def test_do_ocr_googleocr(self):
"""Test page._do_ocr(ocr_tool='googleOCR')."""
@@ -381,7 +384,8 @@
self.skipTest(text)
ref_error, ref_text = self.data['googleOCR']
self.assertEqual(error, ref_error)
- self.assertEqual(text, ref_text)
+ s = difflib.SequenceMatcher(None, text, ref_text)
+ self.assertGreater(s.ratio(), 0.9)
def test_ocr_googleocr(self):
"""Test page.ocr(ocr_tool='googleOCR')."""
@@ -391,7 +395,8 @@
self.assertIsInstance(exc, ValueError)
else:
ref_error, ref_text = self.data['googleOCR']
- self.assertEqual(text, ref_text)
+ s = difflib.SequenceMatcher(None, text, ref_text)
+ self.assertGreater(s.ratio(), 0.9)
@require_modules('bs4')
--
To view, visit https://gerrit.wikimedia.org/r/517756
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I500ddc6e76e0b5d4032b0f7a79e1632a9b5b3b24
Gerrit-Change-Number: 517756
Gerrit-PatchSet: 2
Gerrit-Owner: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
Gerrit-CC: Xqt <info(a)gno.de>