Ejemplo n.º 1
0
    def test_get_bounded_semaphore(self, mr_async_lock: PosixThreadLock):
        try:
            _bounded_semaphore = mr_async_lock.get_bounded_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()
        _bounded_semaphore = mr_async_lock.get_bounded_semaphore(
            loop=_event_loop, value=_Semaphore_Value)
        assert isinstance(
            _bounded_semaphore, async_BoundedSemaphore
        ) is True, "This type of instance should be 'asyncio.lock.BoundedSemaphore'."
Ejemplo n.º 2
0
 def test_get_bounded_semaphore(self, mr_lock: PosixThreadLock):
     _bounded_semaphore = mr_lock.get_bounded_semaphore(
         value=_Semaphore_Value)
     assert isinstance(
         _bounded_semaphore, BoundedSemaphore
     ) is True, "This type of instance should be 'threading.BoundedSemaphore'."