1616)
1717RGX_REPR = re .compile (STR_RGX_REPR )
1818
19- if sys .version_info >= (3 , 7 ):
20-
21- def deprecate (self ):
22- return self .assertWarns (DeprecationWarning )
23-
24- else :
25-
26- class deprecate :
27- def __init__ (self , tc ):
28- pass
29-
30- def __enter__ (self ):
31- return self
32-
33- def __exit__ (self , * tb ):
34- pass
35-
36-
3719class LockTests (test_utils .TestCase ):
3820 def setUp (self ):
3921 super ().setUp ()
@@ -59,7 +41,7 @@ def test_repr(self):
5941
6042 @asyncio .coroutine
6143 def acquire_lock ():
62- with deprecate (self ):
44+ with test_utils . deprecate (self , ( 3 , 7 ) ):
6345 yield from lock
6446
6547 self .loop .run_until_complete (acquire_lock ())
@@ -71,7 +53,7 @@ def test_lock(self):
7153
7254 @asyncio .coroutine
7355 def acquire_lock ():
74- with deprecate (self ):
56+ with test_utils . deprecate (self , ( 3 , 7 ) ):
7557 return (yield from lock )
7658
7759 res = self .loop .run_until_complete (acquire_lock ())
@@ -230,7 +212,7 @@ def test_context_manager(self):
230212
231213 @asyncio .coroutine
232214 def acquire_lock ():
233- with deprecate (self ):
215+ with test_utils . deprecate (self , ( 3 , 7 ) ):
234216 return (yield from lock )
235217
236218 with self .loop .run_until_complete (acquire_lock ()):
@@ -243,7 +225,7 @@ def test_context_manager_cant_reuse(self):
243225
244226 @asyncio .coroutine
245227 def acquire_lock ():
246- with deprecate (self ):
228+ with test_utils . deprecate (self , ( 3 , 7 ) ):
247229 return (yield from lock )
248230
249231 # This spells "yield from lock" outside a generator.
@@ -675,7 +657,7 @@ def test_context_manager(self):
675657
676658 @asyncio .coroutine
677659 def acquire_cond ():
678- with deprecate (self ):
660+ with test_utils . deprecate (self , ( 3 , 7 ) ):
679661 return (yield from cond )
680662
681663 with self .loop .run_until_complete (acquire_cond ()):
@@ -759,7 +741,7 @@ def test_semaphore(self):
759741
760742 @asyncio .coroutine
761743 def acquire_lock ():
762- with deprecate (self ):
744+ with test_utils . deprecate (self , ( 3 , 7 ) ):
763745 return (yield from sem )
764746
765747 res = self .loop .run_until_complete (acquire_lock ())
@@ -899,7 +881,7 @@ def test_context_manager(self):
899881
900882 @asyncio .coroutine
901883 def acquire_lock ():
902- with deprecate (self ):
884+ with test_utils . deprecate (self , ( 3 , 7 ) ):
903885 return (yield from sem )
904886
905887 with self .loop .run_until_complete (acquire_lock ()):
0 commit comments