diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2014-07-26 14:54:34 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2014-07-26 14:54:34 (GMT) |
commit | f21fcd09c50d30ca99e9fa95f70dba481bd46f1b (patch) | |
tree | 1f73c8e8e6d7e8d5b3651f38239498d201efcdd5 /Lib/test/test_asyncio | |
parent | e254e53c833d39e1e479a16d7976a7726c0c1981 (diff) | |
download | cpython-f21fcd09c50d30ca99e9fa95f70dba481bd46f1b.zip cpython-f21fcd09c50d30ca99e9fa95f70dba481bd46f1b.tar.gz cpython-f21fcd09c50d30ca99e9fa95f70dba481bd46f1b.tar.bz2 |
Accept optional lock object in Condition ctor (tulip issue #198)
Diffstat (limited to 'Lib/test/test_asyncio')
-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 8ad1486..c4e74e3 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): |