jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/721274 )
Change subject: [cleanup] Remove deprecated textlib.unescape function ......................................................................
[cleanup] Remove deprecated textlib.unescape function
Change-Id: If3101e2369d8eaf9fe30f2818e501cffe0ba2141 --- M pywikibot/textlib.py M tests/textlib_tests.py 2 files changed, 2 insertions(+), 30 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index d2a3071..b5e5bfe 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -11,7 +11,6 @@ # Distributed under the terms of the MIT license. # import datetime -import html import re from collections import OrderedDict, namedtuple from collections.abc import Sequence @@ -25,11 +24,7 @@ from pywikibot.backports import Tuple from pywikibot.exceptions import InvalidTitleError, SiteDefinitionError from pywikibot.family import Family -from pywikibot.tools import ( - deprecate_arg, - deprecated, - issue_deprecation_warning, -) +from pywikibot.tools import deprecate_arg, issue_deprecation_warning
try: @@ -155,12 +150,6 @@ return phrase
-@deprecated('html.unescape', since='20210405') -def unescape(s: str) -> str: - """Replace escaped HTML-special characters by their originals.""" - return html.unescape(s) - - class MultiTemplateMatchBuilder:
"""Build template matcher.""" diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py index 80f7274..7200249 100644 --- a/tests/textlib_tests.py +++ b/tests/textlib_tests.py @@ -18,7 +18,7 @@ from pywikibot.exceptions import UnknownSiteError from pywikibot.site._interwikimap import _IWEntry from pywikibot.textlib import MultiTemplateMatchBuilder, extract_sections -from pywikibot.tools import has_module, suppress_warnings +from pywikibot.tools import has_module from tests import mock from tests.aspects import ( DefaultDrySiteTestCase, @@ -1505,23 +1505,6 @@ self.assertEqual(set(lang_links), self.sites_set - {self.site})
-UNESCAPE_WARNING_MSG = (r'.*pywikibot.textlib.unescape .*' - r'is deprecated for .*; use html.unescape') - - -class TestUnescape(TestCase): - - """Test to verify that unescaping HTML chars are correctly done.""" - - net = False - - def test_unescape(self): - """Test unescaping HTML chars.""" - with suppress_warnings(UNESCAPE_WARNING_MSG, category=FutureWarning): - self.assertEqual(textlib.unescape('!23<>'"&&'), - '!23<>'"&&') - - class TestExtractSections(DefaultDrySiteTestCase):
"""Test the extract_sections function."""
pywikibot-commits@lists.wikimedia.org