diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2014-07-26 17:54:34 +0300 |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2014-07-26 17:54:34 +0300 |
commit | eff3a16c90e73831e6618dd165d8401c15aacab8 (patch) | |
tree | 98bdb6f8d87534c8b14914cdc4b0d4abf9124f08 /Lib/test/test_asyncio/test_locks.py | |
parent | df9e4a7d69467e6a42bd64c5346f7f873870d076 (diff) | |
download | cpython-eff3a16c90e73831e6618dd165d8401c15aacab8.tar.gz |
Accept optional lock object in Condition ctor (tulip issue #198)
Diffstat (limited to 'Lib/test/test_asyncio/test_locks.py')
-rw-r--r-- | Lib/test/test_asyncio/test_locks.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py index 8ad148634a..c4e74e3330 100644 --- a/Lib/test/test_asyncio/test_locks.py +++ b/Lib/test/test_asyncio/test_locks.py @@ -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): |