summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_locks.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2014-07-26 17:54:34 +0300
committerAndrew Svetlov <andrew.svetlov@gmail.com>2014-07-26 17:54:34 +0300
commiteff3a16c90e73831e6618dd165d8401c15aacab8 (patch)
tree98bdb6f8d87534c8b14914cdc4b0d4abf9124f08 /Lib/test/test_asyncio/test_locks.py
parentdf9e4a7d69467e6a42bd64c5346f7f873870d076 (diff)
downloadcpython-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.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 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):