jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/387938 )
Change subject: [bugfix][TEST] cc: Get removeUselessSpaces working with tabs ......................................................................
[bugfix][TEST] cc: Get removeUselessSpaces working with tabs
Bug: T179043 Change-Id: I65c57ace1a2357ece28e1cbab258574d117d57a6 --- M pywikibot/cosmetic_changes.py M tests/cosmetic_changes_tests.py 2 files changed, 4 insertions(+), 1 deletion(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/cosmetic_changes.py b/pywikibot/cosmetic_changes.py index 179542e..6631531 100755 --- a/pywikibot/cosmetic_changes.py +++ b/pywikibot/cosmetic_changes.py @@ -621,7 +621,7 @@ exceptions = ['comment', 'math', 'nowiki', 'pre', 'startspace', 'table'] if self.site.sitename != 'wikipedia:cs': exceptions.append('template') - text = textlib.replaceExcept(text, r'(?m) +( |$)', r'\1', exceptions, + text = textlib.replaceExcept(text, r'(?m)[\t ]+( |$)', r'\1', exceptions, site=self.site) return text
diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index 668fdb1..83d2c4e 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -70,6 +70,9 @@ # startspace self.assertEqual(' Foo bar ', self.cct.removeUselessSpaces(' Foo bar ')) + # tab + self.assertEqual('Fooooo bar', + self.cct.removeUselessSpaces('Fooooo bar '))
def test_removeNonBreakingSpaceBeforePercent(self): """Test removeNonBreakingSpaceBeforePercent method."""
pywikibot-commits@lists.wikimedia.org