コード例 #1
0
    def test_get_lock(self, mr_async_lock: PosixThreadLock):
        try:
            _lock = mr_async_lock.get_lock()
        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()
        _lock = mr_async_lock.get_lock(loop=_event_loop)
        assert isinstance(
            _lock, async_Lock
        ) is True, "This type of instance should be 'asyncio.lock.RLock'."
コード例 #2
0
 def test_get_lock(self, mr_lock: PosixThreadLock):
     _lock = mr_lock.get_lock()
     _thread_lock = Lock()
     assert isinstance(
         _lock, type(_thread_lock)
     ) is True, "This type of instance should be 'threading.Lock'."
コード例 #3
0
 def test_get_lock(self, mr_lock: PosixThreadLock):
     _lock = mr_lock.get_lock()
     assert isinstance(
         _lock, Lock
     ) is True, "This type of instance should be 'multiprocessing.synchronize.Lock'."
コード例 #4
0
 def test_get_lock(self, mr_gevent_lock: PosixThreadLock):
     _lock = mr_gevent_lock.get_lock()
     assert isinstance(
         _lock, gevent_Lock
     ) is True, "This type of instance should be 'gevent.threading.Lock'."