https://github.com/tensorly/tensorly
Revision bfda61015d0817d259ec539d4fcf876e81a5ed1d authored by Jean Kossaifi on 14 April 2021, 11:14:29 UTC, committed by Jean Kossaifi on 14 April 2021, 11:14:29 UTC
1 parent 7cc806c
Tip revision: bfda61015d0817d259ec539d4fcf876e81a5ed1d authored by Jean Kossaifi on 14 April 2021, 11:14:29 UTC
Pypi Worflow: use correct token for test pypi
Pypi Worflow: use correct token for test pypi
Tip revision: bfda610
test_deprecation.py
from ..deprecation import deprecated, DefineDeprecated
def test_deprecated():
class Dummy(object):
def __init__(self, arg=1):
self.arg = arg + 1
def fun1():
return 2
# Test using the deprecated function
@deprecated(Dummy, use_deprecated=True)
class Deprecated():
def __init__(self, arg=1):
self.arg = arg
@deprecated(fun1, use_deprecated=True)
def fun2():
return 1
instance = Deprecated(1)
assert instance.arg == 1
assert fun2() == 1
# Test using the new function instead
@deprecated(Dummy, use_deprecated=False)
class Deprecated():
def __init__(self, arg=1):
self.arg = arg
@deprecated(fun1, use_deprecated=False)
def fun2():
return 2
instance = Deprecated(1)
assert instance.arg == 2
assert fun2() == 2
Computing file changes ...