Skip to content

Commit aeb56d8

Browse files
author
manas-shinde
committed
feat : Added new decorator - deprecated.
1 parent 451d12d commit aeb56d8

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

decorators/deprecated.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import time
2+
import functools
3+
4+
5+
def deprecated(func):
6+
@functools.wraps(func)
7+
def wrapper():
8+
print("Warning!!!")
9+
return wrapper

tests/test_deprecated.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from decorators.deprecated import deprecated
2+
3+
@deprecated
4+
def test():
5+
print("Inside test")
6+
7+
8+
def test_deprecated():
9+
test()
10+
print("Success")

0 commit comments

Comments
 (0)