Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1085592?usp=email )

Change subject: [bugfix] extract linktrail for hr-wiki
......................................................................

[bugfix] extract linktrail for hr-wiki

Replace r'\p{L}' pattern to r'[^\W\d_]'
unless we sometime have regex package mandatory with Pywikibot

Bug: T378787
Change-Id: I6247df4a4052e3376b159151c77bcafd701660de
---
M pywikibot/site/_apisite.py
M tests/site_tests.py
2 files changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Matěj Suchánek: Looks good to me, approved
  Xqt: Verified; Looks good to me, approved




diff --git a/pywikibot/site/_apisite.py b/pywikibot/site/_apisite.py
index 2a3ec9c..adbdd6f 100644
--- a/pywikibot/site/_apisite.py
+++ b/pywikibot/site/_apisite.py
@@ -872,6 +872,9 @@
         if linktrail == '/^()(.*)$/sD':  # empty linktrail
             return ''

+        # T378787
+        linktrail = linktrail.replace(r'\p{L}', r'[^\W\d_]')
+
         match = re.search(r'\((?:\:\?|\?\:)?\[(?P<pattern>.+?)\]'
                           r'(?P<letters>(\|.)*)\)?\+\)', linktrail)
         if not match:
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 83f0c7d..c01b7c3 100755
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -1015,7 +1015,8 @@
         small_wikis = self.site.family.languages_by_size[-size:]
         great_wikis = self.site.family.languages_by_size[:-size]
         great_wikis = random.sample(great_wikis, size)
-        for code in sorted(small_wikis + great_wikis):
+        # Also test for 'hr' which failed due to T378787
+        for code in {'hr', *small_wikis, *great_wikis}:
             site = pywikibot.Site(code, self.family)
             with self.subTest(site=site):
                 self.assertIsInstance(site.linktrail(), str)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1085592?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I6247df4a4052e3376b159151c77bcafd701660de
Gerrit-Change-Number: 1085592
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to