示例#1
0
    def test_get_semaphore(self, mr_async_lock: PosixThreadLock):
        try:
            _semaphore = mr_async_lock.get_semaphore(value=_Semaphore_Value)
        except ValueError as e:
            assert "Async Event Loop object cannot be empty" in str(
                e
            ), "The exception error should be 'Async Event Loop object cannot be empty'."

        _event_loop = new_event_loop()
        _semaphore = mr_async_lock.get_semaphore(loop=_event_loop,
                                                 value=_Semaphore_Value)
        assert isinstance(
            _semaphore, async_Semaphore
        ) is True, "This type of instance should be 'asyncio.lock.Semaphore'."
示例#2
0
 def test_get_semaphore(self, mr_lock: PosixThreadLock):
     _semaphore = mr_lock.get_semaphore(value=_Semaphore_Value)
     assert isinstance(
         _semaphore, Semaphore
     ) is True, "This type of instance should be 'threading.Semaphore'."