Silenced warnings in deprecation tests.
This commit is contained in:
parent
e4c0878b30
commit
e26b780a24
|
@ -51,9 +51,11 @@ class RenameMethodsTests(SimpleTestCase):
|
||||||
"""
|
"""
|
||||||
Ensure `old` complains when only `old` is defined.
|
Ensure `old` complains when only `old` is defined.
|
||||||
"""
|
"""
|
||||||
class Manager(metaclass=RenameManagerMethods):
|
msg = '`Manager.old` method should be renamed `new`.'
|
||||||
def old(self):
|
with self.assertWarnsMessage(DeprecationWarning, msg):
|
||||||
pass
|
class Manager(metaclass=RenameManagerMethods):
|
||||||
|
def old(self):
|
||||||
|
pass
|
||||||
manager = Manager()
|
manager = Manager()
|
||||||
|
|
||||||
with warnings.catch_warnings(record=True) as recorded:
|
with warnings.catch_warnings(record=True) as recorded:
|
||||||
|
@ -74,9 +76,11 @@ class RenameMethodsTests(SimpleTestCase):
|
||||||
def new(self):
|
def new(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Deprecated(Renamed):
|
msg = '`Deprecated.old` method should be renamed `new`.'
|
||||||
def old(self):
|
with self.assertWarnsMessage(DeprecationWarning, msg):
|
||||||
super().old()
|
class Deprecated(Renamed):
|
||||||
|
def old(self):
|
||||||
|
super().old()
|
||||||
|
|
||||||
deprecated = Deprecated()
|
deprecated = Deprecated()
|
||||||
|
|
||||||
|
@ -93,9 +97,11 @@ class RenameMethodsTests(SimpleTestCase):
|
||||||
Ensure the correct warnings are raised when a class that renamed
|
Ensure the correct warnings are raised when a class that renamed
|
||||||
`old` subclass one that didn't.
|
`old` subclass one that didn't.
|
||||||
"""
|
"""
|
||||||
class Deprecated(metaclass=RenameManagerMethods):
|
msg = '`Deprecated.old` method should be renamed `new`.'
|
||||||
def old(self):
|
with self.assertWarnsMessage(DeprecationWarning, msg):
|
||||||
pass
|
class Deprecated(metaclass=RenameManagerMethods):
|
||||||
|
def old(self):
|
||||||
|
pass
|
||||||
|
|
||||||
class Renamed(Deprecated):
|
class Renamed(Deprecated):
|
||||||
def new(self):
|
def new(self):
|
||||||
|
@ -130,8 +136,10 @@ class RenameMethodsTests(SimpleTestCase):
|
||||||
def old(self):
|
def old(self):
|
||||||
super().old()
|
super().old()
|
||||||
|
|
||||||
class Deprecated(DeprecatedMixin, RenamedMixin, Renamed):
|
msg = '`DeprecatedMixin.old` method should be renamed `new`.'
|
||||||
pass
|
with self.assertWarnsMessage(DeprecationWarning, msg):
|
||||||
|
class Deprecated(DeprecatedMixin, RenamedMixin, Renamed):
|
||||||
|
pass
|
||||||
|
|
||||||
deprecated = Deprecated()
|
deprecated = Deprecated()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue