def test_rlock_with_none_value(self): try: Globalize.rlock(rlock=None) except GlobalizeObjectError as e: assert "Cannot globalize target object because it is None object" in str( e ), "It should raise an exception about target object could not be a None object." else: assert False, "It should raise an exception if the value is None."
def test_rlock_with_normal_value(self): from multiprocessing.synchronize import RLock as synchronize_RLock from multiprocessing import RLock Globalize.rlock(rlock=RLock()) from multirunnable.api.manage import Running_RLock assert isinstance( Running_RLock, synchronize_RLock ) is True, "It should save instance to the target global variable *Running_RLock*."
def globalize_instance(self, obj) -> None: _Globalize.rlock(rlock=obj)