mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Accept optional lock object in Condition ctor (tulip issue #198)
This commit is contained in:
parent
e254e53c83
commit
f21fcd09c5
2 changed files with 18 additions and 3 deletions
|
@ -656,6 +656,18 @@ class ConditionTests(test_utils.TestCase):
|
|||
|
||||
self.assertFalse(cond.locked())
|
||||
|
||||
def test_explicit_lock(self):
|
||||
lock = asyncio.Lock(loop=self.loop)
|
||||
cond = asyncio.Condition(lock, loop=self.loop)
|
||||
|
||||
self.assertIs(lock._loop, cond._loop)
|
||||
|
||||
def test_ambiguous_loops(self):
|
||||
loop = self.new_test_loop()
|
||||
lock = asyncio.Lock(loop=self.loop)
|
||||
with self.assertRaises(ValueError):
|
||||
asyncio.Condition(lock, loop=loop)
|
||||
|
||||
|
||||
class SemaphoreTests(test_utils.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue