jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] Deprecating multiple parameters at once ......................................................................
[FEAT] Deprecating multiple parameters at once
This allows to deprecate multitple parameters in one go. This helps to shorten the stacktrace, because with @deprecate_arg it would add one function call for each deprecated argument.
All usages of multiple @deprecate_arg have been converted.
Change-Id: I30e1330065d7d19e900d40a661ad356c6b7427b9 --- M pywikibot/login.py M pywikibot/page.py M pywikibot/pagegenerators.py M pywikibot/site.py M pywikibot/tools.py M scripts/category.py M tests/deprecation_tests.py 7 files changed, 160 insertions(+), 144 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/login.py b/pywikibot/login.py index 2c864e6..13eef79 100644 --- a/pywikibot/login.py +++ b/pywikibot/login.py @@ -13,7 +13,7 @@
import pywikibot from pywikibot import config -from pywikibot.tools import deprecate_arg +from pywikibot.tools import deprecated_args from pywikibot.exceptions import NoUsername
_logger = "wiki.login" @@ -32,8 +32,7 @@
class LoginManager: - @deprecate_arg("username", "user") - @deprecate_arg("verbose", None) + @deprecated_args(username="user", verbose=None) def __init__(self, password=None, sysop=False, site=None, user=None): if site is not None: self.site = site diff --git a/pywikibot/page.py b/pywikibot/page.py index 6b1c10c..1b2b788 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -48,7 +48,9 @@ AutoblockUser, UserActionRefuse, SiteDefinitionError ) -from pywikibot.tools import ComparableMixin, deprecated, deprecate_arg +from pywikibot.tools import ( + ComparableMixin, deprecated, deprecate_arg, deprecated_args +) from pywikibot import textlib
@@ -71,8 +73,7 @@
"""
- @deprecate_arg("insite", None) - @deprecate_arg("defaultNamespace", "ns") + @deprecated_args(insite=None, defaultNamespace="ns") def __init__(self, source, title=u"", ns=0): """Instantiate a Page object.
@@ -156,8 +157,7 @@ """ return self._link.namespace
- @deprecate_arg("decode", None) - @deprecate_arg("savetitle", "asUrl") + @deprecated_args(decode=None, savetitle="asUrl") def title(self, underscore=False, withNamespace=True, withSection=True, asUrl=False, asLink=False, allowInterwiki=True, forceInterwiki=False, textlink=False, @@ -237,8 +237,7 @@ title = title.replace(forbidden, '_') return title
- @deprecate_arg("decode", None) - @deprecate_arg("underscore", None) + @deprecated_args(decode=None, underscore=None) def section(self): """Return the name of the section this Page refers to.
@@ -299,8 +298,7 @@ """Return True if title of this Page is in the autoFormat dictionary.""" return self.autoFormat()[0] is not None
- @deprecate_arg("throttle", None) - @deprecate_arg("change_edit_time", None) + @deprecated_args(throttle=None, change_edit_time=None) def get(self, force=False, get_redirect=False, sysop=False): """Return the wiki-text of the page.
@@ -365,8 +363,7 @@ self._getexception = pywikibot.IsRedirectPage(self) raise self._getexception
- @deprecate_arg("throttle", None) - @deprecate_arg("change_edit_time", None) + @deprecated_args(throttle=None, change_edit_time=None) def getOldVersion(self, oldid, force=False, get_redirect=False, sysop=False): """Return text of an old revision of this page; same options as get(). @@ -1242,8 +1239,7 @@ return self.site.pagetemplates(self, step=step, total=total, content=content)
- @deprecate_arg("followRedirects", None) - @deprecate_arg("loose", None) + @deprecated_args(followRedirects=None, loose=None) def imagelinks(self, step=None, total=None, content=False): """Iterate FilePage objects for images displayed on this Page.
@@ -1308,8 +1304,7 @@ result.append((pywikibot.Page(link, self.site), positional)) return result
- @deprecate_arg("nofollow_redirects", None) - @deprecate_arg("get_redirect", None) + @deprecated_args(nofollow_redirects=None, get_redirect=None) def categories(self, withSortKey=False, step=None, total=None, content=False): """Iterate categories that the article is in. @@ -1364,9 +1359,7 @@ # BREAKING CHANGE: in old framework, default value for getVersionHistory # returned no more than 500 revisions; now, it iterates # all revisions unless 'total' argument is used - @deprecate_arg("forceReload", None) - @deprecate_arg("revCount", "total") - @deprecate_arg("getAll", None) + @deprecated_args(forceReload=None, revCount="total", getAll=None) def getVersionHistory(self, reverseOrder=False, step=None, total=None): """Load the version history page and return history information. @@ -1390,14 +1383,13 @@ reverse=not reverseOrder) ]
- def getVersionHistoryTable(self, forceReload=False, reverseOrder=False, - step=None, total=None): + @deprecated_args(forceReload=None) + def getVersionHistoryTable(self, reverseOrder=False, step=None, total=None): """Return the version history as a wiki table.""" result = '{| class="wikitable"\n' result += '! oldid || date/time || username || edit summary\n' for oldid, time, username, summary \ - in self.getVersionHistory(forceReload=forceReload, - reverseOrder=reverseOrder, + in self.getVersionHistory(reverseOrder=reverseOrder, step=step, total=total): result += '|----\n' result += '| %s || %s || %s || <nowiki>%s</nowiki>\n'\ @@ -1960,9 +1952,7 @@ raise ValueError(u"'%s' is not in the category namespace!" % title)
- @deprecate_arg("forceInterwiki", None) - @deprecate_arg("textlink", None) - @deprecate_arg("noInterwiki", None) + @deprecated_args(forceInterwiki=None, textlink=None, noInterwiki=None) def aslink(self, sortKey=None): """Return a link to place a page in this Category.
@@ -1982,8 +1972,7 @@ titleWithSortKey = self.title(withSection=False) return '[[%s]]' % titleWithSortKey
- @deprecate_arg("startFrom", None) - @deprecate_arg("cacheResults", None) + @deprecated_args(startFrom=None, cacheResults=None) def subcategories(self, recurse=False, step=None, total=None, content=False): """Iterate all subcategories of the current category. @@ -2286,8 +2275,7 @@ This class also represents the Wiki page User:<username> """
- @deprecate_arg("site", "source") - @deprecate_arg("name", "title") + @deprecated_args(site="source", name="title") def __init__(self, source, title=u''): """Initializer for a User object.
@@ -4477,8 +4465,7 @@ return x
-@deprecate_arg('site2', None) -@deprecate_arg('site', 'encodings') +@deprecated_args(site2=None, site='encodings') def url2unicode(title, encodings='utf-8'): """ Convert URL-encoded text to unicode using several encoding. diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index a57a22a..ea34ddd 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -28,7 +28,7 @@ import time import pywikibot from pywikibot import date, config, i18n -from pywikibot.tools import deprecate_arg +from pywikibot.tools import deprecated_args from pywikibot.comms import http import pywikibot.data.wikidataquery as wdquery
@@ -603,9 +603,7 @@ content=content)
-@deprecate_arg("number", "total") -@deprecate_arg("namespace", "namespaces") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", namespace="namespaces", repeat=None) def NewpagesPageGenerator(get_redirect=False, site=None, namespaces=[0, ], step=None, total=None): """ @@ -814,7 +812,7 @@ yield pywikibot.Page(pywikibot.Link(title, site))
-@deprecate_arg("number", "total") +@deprecated_args(number="total") def UserContributionsGenerator(username, namespaces=None, site=None, step=None, total=None): """Yield unique pages edited by user:username. @@ -910,7 +908,7 @@ return regex
@classmethod - @deprecate_arg("inverse", "quantifier") + @deprecated_args(inverse="quantifier") def titlefilter(cls, generator, regex, quantifier='any', ignore_namespace=True): """ Yield pages from another generator whose title matches regex. @@ -1057,8 +1055,7 @@ yield item
-@deprecate_arg("pageNumber", "step") -@deprecate_arg("lookahead", None) +@deprecated_args(pageNumber="step", lookahead=None) def PreloadingGenerator(generator, step=50): """Yield preloaded pages taken from another generator.""" # pages may be on more than one site, for example if an interwiki @@ -1117,7 +1114,7 @@ yield i
-@deprecate_arg("number", "total") +@deprecated_args(number="total") def NewimagesPageGenerator(step=None, total=None, site=None): if site is None: site = pywikibot.Site() @@ -1143,9 +1140,7 @@
# TODO below -@deprecate_arg("extension", None) -@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(extension=None, number="total", repeat=None) def UnusedFilesGenerator(total=100, site=None, extension=None): if site is None: site = pywikibot.Site() @@ -1153,8 +1148,7 @@ yield pywikibot.FilePage(page.site, page.title())
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def WithoutInterwikiPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1162,8 +1156,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def UnCategorizedCategoryGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1171,8 +1164,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def UnCategorizedImageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1180,8 +1172,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def UnCategorizedPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1196,8 +1187,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def LonelyPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1205,8 +1195,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def UnwatchedPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1221,8 +1210,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def AncientPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1230,8 +1218,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def DeadendPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1239,8 +1226,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def LongPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1248,8 +1234,7 @@ yield page
-@deprecate_arg("number", "total") -@deprecate_arg("repeat", None) +@deprecated_args(number="total", repeat=None) def ShortPagesPageGenerator(total=100, site=None): if site is None: site = pywikibot.Site() @@ -1257,7 +1242,7 @@ yield page
-@deprecate_arg("number", "total") +@deprecated_args(number="total") def RandomPageGenerator(total=10, site=None): if site is None: site = pywikibot.Site() @@ -1265,7 +1250,7 @@ yield page
-@deprecate_arg("number", "total") +@deprecated_args(number="total") def RandomRedirectPageGenerator(total=10, site=None): if site is None: site = pywikibot.Site() diff --git a/pywikibot/site.py b/pywikibot/site.py index 7c1156d..879fb15 100644 --- a/pywikibot/site.py +++ b/pywikibot/site.py @@ -29,7 +29,7 @@ import pywikibot.family from pywikibot.tools import ( itergroup, deprecated, deprecate_arg, UnicodeMixin, ComparableMixin, - redirect_func, add_decorated_full_name, + redirect_func, add_decorated_full_name, deprecated_args ) from pywikibot.tools import MediaWikiVersion as LV from pywikibot.throttle import Throttle @@ -2979,9 +2979,7 @@ 'subcats': 0} return category._catinfo
- @deprecate_arg("throttle", None) - @deprecate_arg("limit", "total") - @deprecate_arg("includeredirects", "filterredir") + @deprecated_args(throttle=None, limit="total", includeredirects="filterredir") def allpages(self, start="!", prefix="", namespace=0, filterredir=None, filterlanglinks=None, minsize=None, maxsize=None, protect_type=None, protect_level=None, reverse=False, @@ -4533,11 +4531,11 @@ filepage._imageinfo = result["imageinfo"] return
- @deprecate_arg("number", "step") - @deprecate_arg("repeat", None) - @deprecate_arg("namespace", "namespaces") - @deprecate_arg("rc_show", None) - @deprecate_arg("get_redirect", None) # 20120822 + @deprecated_args(number="step", + repeat=None, + namespace="namespaces", + rc_show=None, + get_redirect=None) # 20120822 def newpages(self, user=None, returndict=False, start=None, end=None, reverse=False, showBot=False, showRedirects=False, excludeuser=None, @@ -4597,13 +4595,11 @@ yield (filepage, date, user, comment)
@deprecated("Site().newfiles()") - @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def newimages(self, *args, **kwargs): return self.newfiles(*args, **kwargs)
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def longpages(self, step=None, total=None): """Yield Pages and lengths from Special:Longpages.
@@ -4619,8 +4615,7 @@ yield (pywikibot.Page(self, pageitem['title']), int(pageitem['value']))
- @deprecate_arg("number", "total") - @deprecate_arg("repeat", None) + @deprecated_args(number="total", repeat=None) def shortpages(self, step=None, total=None): """Yield Pages and lengths from Special:Shortpages.
@@ -4636,8 +4631,7 @@ yield (pywikibot.Page(self, pageitem['title']), int(pageitem['value']))
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def deadendpages(self, step=None, total=None): """Yield Page objects retrieved from Special:Deadendpages.
@@ -4649,8 +4643,7 @@ step=step, total=total) return degen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def ancientpages(self, step=None, total=None): """Yield Pages, datestamps from Special:Ancientpages.
@@ -4664,8 +4657,7 @@ yield (pywikibot.Page(self, pageitem['title']), pywikibot.Timestamp.fromISOformat(pageitem['timestamp']))
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def lonelypages(self, step=None, total=None): """Yield Pages retrieved from Special:Lonelypages.
@@ -4677,8 +4669,7 @@ step=step, total=total) return lpgen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def unwatchedpages(self, step=None, total=None): """Yield Pages from Special:Unwatchedpages (requires Admin privileges).
@@ -4701,8 +4692,7 @@ step=step, total=total) return wpgen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def uncategorizedcategories(self, number=None, repeat=True, step=None, total=None): """Yield Categories from Special:Uncategorizedcategories. @@ -4716,8 +4706,7 @@ step=step, total=total) return ucgen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def uncategorizedimages(self, number=None, repeat=True, step=None, total=None): """Yield FilePages from Special:Uncategorizedimages. @@ -4734,8 +4723,7 @@ # synonym uncategorizedfiles = uncategorizedimages
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def uncategorizedpages(self, number=None, repeat=True, step=None, total=None): """Yield Pages from Special:Uncategorizedpages. @@ -4749,8 +4737,7 @@ step=step, total=total) return upgen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def uncategorizedtemplates(self, number=None, repeat=True, step=None, total=None): """Yield Pages from Special:Uncategorizedtemplates. @@ -4764,8 +4751,7 @@ step=step, total=total) return utgen
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def unusedcategories(self, step=None, total=None): """Yield Category objects from Special:Unusedcategories.
@@ -4791,13 +4777,11 @@ return uigen
@deprecated("Site().unusedfiles()") - @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def unusedimages(self, *args, **kwargs): return self.unusedfiles(*args, **kwargs)
- @deprecate_arg("number", None) - @deprecate_arg("repeat", None) + @deprecated_args(number=None, repeat=None) def withoutinterwiki(self, step=None, total=None): """Yield Pages without language links from Special:Withoutinterwiki.
diff --git a/pywikibot/tools.py b/pywikibot/tools.py index dde154a..e7c0bec 100644 --- a/pywikibot/tools.py +++ b/pywikibot/tools.py @@ -476,6 +476,17 @@
def deprecate_arg(old_arg, new_arg): """Decorator to declare old_arg deprecated and replace it with new_arg.""" + return deprecated_args(**{old_arg: new_arg}) + + +def deprecated_args(**arg_pairs): + """ + Decorator to declare multiple args deprecated. + + @param arg_pairs: Each entry points to the new argument name. With True or + None it drops the value and prints a warning. If False it just drops + the value. + """ _logger = ""
def decorator(obj): @@ -497,22 +508,24 @@ @rtype: any """ name = obj.__full_name__ - if old_arg in __kw: - if new_arg: - if new_arg in __kw: - warning( -u"%(new_arg)s argument of %(name)s replaces %(old_arg)s; cannot use both." - % locals()) - else: - warning( -u"%(old_arg)s argument of %(name)s is deprecated; use %(new_arg)s instead." - % locals()) - __kw[new_arg] = __kw[old_arg] - else: - debug( -u"%(old_arg)s argument of %(name)s is deprecated." - % locals(), _logger) - del __kw[old_arg] + for old_arg, new_arg in arg_pairs.items(): + if old_arg in __kw: + if new_arg not in [True, False, None]: + if new_arg in __kw: + warning(u"%(new_arg)s argument of %(name)s " + "replaces %(old_arg)s; cannot use both." + % locals()) + else: + # If the value is positionally given this will + # cause a TypeError, which is intentional + warning(u"%(old_arg)s argument of %(name)s " + "is deprecated; use %(new_arg)s instead." + % locals()) + __kw[new_arg] = __kw[old_arg] + elif new_arg is not False: + debug(u"%(old_arg)s argument of %(name)s is " + "deprecated." % locals(), _logger) + del __kw[old_arg] return obj(*__args, **__kw)
wrapper.__doc__ = obj.__doc__ diff --git a/scripts/category.py b/scripts/category.py index 5fc81b0..429fc8a 100755 --- a/scripts/category.py +++ b/scripts/category.py @@ -115,7 +115,9 @@ from pywikibot import Bot from pywikibot import config, pagegenerators from pywikibot import i18n, textlib -from pywikibot.tools import deprecate_arg, deprecated, ModuleDeprecationWrapper +from pywikibot.tools import ( + deprecated_args, deprecated, ModuleDeprecationWrapper +)
if sys.version_info[0] > 2: basestring = (str, ) @@ -269,8 +271,7 @@
"""A robot to mass-add a category to a list of pages."""
- @deprecate_arg('editSummary', 'comment') - @deprecate_arg('dry', None) + @deprecated_args(editSummary='comment', dry=None) def __init__(self, generator, newcat=None, sort_by_last_name=False, create=False, comment='', follow_redirects=False): super(CategoryAddBot, self).__init__() @@ -386,15 +387,11 @@ DELETION_COMMENT_AUTOMATIC = 0 DELETION_COMMENT_SAME_AS_EDIT_COMMENT = 1
- @deprecate_arg("oldCatTitle", "oldcat") - @deprecate_arg("newCatTitle", "newcat") - @deprecate_arg("batchMode", "batch") - @deprecate_arg("editSummary", "comment") - @deprecate_arg("inPlace", "inplace") - @deprecate_arg("moveCatPage", "move_oldcat") - @deprecate_arg("deleteEmptySourceCat", "delete_oldcat") - @deprecate_arg("titleRegex", "title_regex") - @deprecate_arg("withHistory", "history") + @deprecated_args(oldCatTitle='oldcat', newCatTitle='newcat', + batchMode='batch', editSummary='comment', + inPlace='inplace', moveCatPage='move_oldcat', + deleteEmptySourceCat='delete_oldcat', + titleRegex='title_regex', withHistory='history') def __init__(self, oldcat, newcat=None, batch=False, comment='', inplace=False, move_oldcat=True, delete_oldcat=True, title_regex=None, history=False, pagesonly=False, diff --git a/tests/deprecation_tests.py b/tests/deprecation_tests.py index 3f5894a..bbdf02b 100644 --- a/tests/deprecation_tests.py +++ b/tests/deprecation_tests.py @@ -7,7 +7,9 @@ # __version__ = '$Id$'
-from pywikibot.tools import deprecated, deprecate_arg, add_full_name +from pywikibot.tools import ( + deprecated, deprecate_arg, deprecated_args, add_full_name +) from tests.aspects import unittest, DeprecationTestCase, TestCase
@@ -98,7 +100,19 @@
@deprecate_arg('bah', 'foo') def deprecated_func_arg(foo=None): - """Deprecated function with arg 'self'.""" + """Deprecated arg 'bah'.""" + return foo + + +@deprecated_args(bah='foo') +def deprecated_func_arg2(foo=None): + """Test deprecated_args with one rename.""" + return foo + + +@deprecated_args(bah='foo', silent=False, loud=True, old=None) +def deprecated_func_arg3(foo=None): + """Test deprecated_args with three drops and one rename.""" return foo
@@ -340,23 +354,60 @@ self.assertDeprecation(__name__ + '.DeprecatedClass is deprecated.')
def test_deprecate_function_arg(self): - rv = deprecated_func_arg() + def tests(func): + rv = func() + self.assertEqual(rv, None) + self.assertNoDeprecation() + + rv = func('a') + self.assertEqual(rv, 'a') + self.assertNoDeprecation() + + rv = func(bah='b') + self.assertEqual(rv, 'b') + self.assertDeprecation('bah argument of ' + __name__ + '.' + func.__name__ + ' is deprecated; use foo instead.') + + DeprecatorTestCase._reset_messages() + + rv = func(foo=1) + self.assertEqual(rv, 1) + self.assertNoDeprecation() + + self.assertRaisesRegex( + TypeError, + r"deprecated_func_arg2?() got multiple values for (keyword )?argument 'foo'", + func, + 'a', bah='b' + ) + DeprecatorTestCase._reset_messages() + + tests(deprecated_func_arg) + tests(deprecated_func_arg2) + + def test_deprecate_and_remove_function_args(self): + rv = deprecated_func_arg3() self.assertEqual(rv, None) self.assertNoDeprecation()
- rv = deprecated_func_arg('a') - self.assertEqual(rv, 'a') + rv = deprecated_func_arg3(foo=1, silent=42) + self.assertEqual(rv, 1) self.assertNoDeprecation()
- rv = deprecated_func_arg(bah='b') - self.assertEqual(rv, 'b') - self.assertDeprecation('bah argument of ' + __name__ + '.deprecated_func_arg is deprecated; use foo instead.') + rv = deprecated_func_arg3(2) + self.assertEqual(rv, 2) + self.assertNoDeprecation() + + rv = deprecated_func_arg3(3, loud='3') + self.assertEqual(rv, 3) + self.assertDeprecation('loud argument of ' + __name__ + '.deprecated_func_arg3 is deprecated.')
DeprecatorTestCase._reset_messages()
- rv = deprecated_func_arg(foo=1) - self.assertEqual(rv, 1) - self.assertNoDeprecation() + rv = deprecated_func_arg3(4, old='4') + self.assertEqual(rv, 4) + self.assertDeprecation('old argument of ' + __name__ + '.deprecated_func_arg3 is deprecated.') + + DeprecatorTestCase._reset_messages()
def test_deprecated_instance_method_zero_arg(self): """Test @deprecate_arg with classes, without arguments."""
pywikibot-commits@lists.wikimedia.org