Skip to content

Commit

Permalink
Deperecate property test. (#4432)
Browse files Browse the repository at this point in the history
Adds a test to the deprecation module for class properties.
  • Loading branch information
MichaelBroughton committed Aug 16, 2021
1 parent 3690440 commit 04dea0c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cirq-core/cirq/_compat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,27 @@ def f(a, b):
assert f(1, 2) == 3


def test_deprecated_with_property():
class AClass(object):
def __init__(self, a):
self.a = a

@property
@deprecated(deadline='v1.2', fix='Stop using.', name='AClass.test_func')
def f(self):
return self.a

instance = AClass(4)
with cirq.testing.assert_deprecated(
'_compat_test.py:',
'AClass.test_func was used',
'will be removed in cirq v1.2',
'Stop using.',
deadline='v1.2',
):
assert instance.f == 4


def test_deprecated():
def new_func(a, b):
return a + b
Expand Down

0 comments on commit 04dea0c

Please sign in to comment.