mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
utils: Add deprecated_attribute decorator
This commit is contained in:
parent
54a9132aea
commit
ec50e18a3e
2 changed files with 54 additions and 0 deletions
|
|
@ -11,6 +11,17 @@ from pelican.utils import NoFilesError
|
|||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
_new_attribute = 'new_value'
|
||||
|
||||
@utils.deprecated_attribute(
|
||||
old='_old_attribute', new='_new_attribute',
|
||||
since=(3, 1, 0), remove=(4, 1, 3))
|
||||
def _old_attribute(): return None
|
||||
|
||||
def test_deprecated_attribute(self):
|
||||
value = self._old_attribute
|
||||
self.assertEquals(value, self._new_attribute)
|
||||
# TODO: check log warning
|
||||
|
||||
def test_get_date(self):
|
||||
# valid ones
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue