예제 #1
0
    def test_get_rlock(self, mr_async_lock: PosixThreadLock):
        try:
            _rlock = mr_async_lock.get_rlock()
        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()
        _rlock = mr_async_lock.get_rlock(loop=_event_loop)
        assert isinstance(
            _rlock, async_Lock
        ) is True, "This type of instance should be 'asyncio.lock.RLock'."
예제 #2
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'."
예제 #3
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'."
예제 #4
0
 def test_get_rlock(self, mr_lock: PosixThreadLock):
     _rlock = mr_lock.get_rlock()
     _thread_rlock = RLock()
     assert isinstance(
         _rlock, type(_thread_rlock)
     ) is True, "This type of instance should be 'threading.RLock'."
예제 #5
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 'multiprocessing.synchronize.Semaphore'."
예제 #6
0
 def test_get_rlock(self, mr_lock: PosixThreadLock):
     _rlock = mr_lock.get_rlock()
     assert isinstance(
         _rlock, RLock
     ) is True, "This type of instance should be 'multiprocessing.synchronize.RLock'."
예제 #7
0
 def test_get_semaphore(self, mr_gevent_lock: PosixThreadLock):
     _semaphore = mr_gevent_lock.get_semaphore(value=_Semaphore_Value)
     assert isinstance(
         _semaphore, gevent_Semaphore
     ) is True, "This type of instance should be 'gevent.lock.Semaphore'."
예제 #8
0
 def test_get_rlock(self, mr_gevent_lock: PosixThreadLock):
     _rlock = mr_gevent_lock.get_rlock()
     assert isinstance(
         _rlock, gevent_RLock
     ) is True, "This type of instance should be 'gevent.lock.RLock'."