summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2014-07-26 14:54:56 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2014-07-26 14:54:56 (GMT)
commita7121b839ae79440ecc8bcc090ca868e2e0b8292 (patch)
tree992dd275504d19a765c2dbb49469fc230393bfdc /Lib/test
parent996b67144665b33a31135d946e3e039a864771df (diff)
parentf21fcd09c50d30ca99e9fa95f70dba481bd46f1b (diff)
downloadcpython-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.py12
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):