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