mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
asyncio: Make Semaphore(0) work properly.
This commit is contained in:
parent
d88c6f9b9b
commit
9c55a58a1d
2 changed files with 6 additions and 2 deletions
|
@ -684,6 +684,10 @@ class SemaphoreTests(unittest.TestCase):
|
|||
finally:
|
||||
events.set_event_loop(None)
|
||||
|
||||
def test_initial_value_zero(self):
|
||||
sem = locks.Semaphore(0, loop=self.loop)
|
||||
self.assertTrue(sem.locked())
|
||||
|
||||
def test_repr(self):
|
||||
sem = locks.Semaphore(loop=self.loop)
|
||||
self.assertTrue(repr(sem).endswith('[unlocked,value:1]>'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue