def test_bounded_semaphore_with_normal_value(self): from multiprocessing.synchronize import Semaphore as synchronize_Semaphore from multiprocessing import BoundedSemaphore Globalize.bounded_semaphore(bsmp=BoundedSemaphore()) from multirunnable.api.manage import Running_Bounded_Semaphore assert isinstance( Running_Bounded_Semaphore, synchronize_Semaphore ) is True, "It should save instance to the target global variable *Running_Bounded_Semaphore*."
def test_bounded_semaphore_with_none_value(self): try: Globalize.bounded_semaphore(bsmp=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 globalize_instance(self, obj) -> None: _Globalize.bounded_semaphore(bsmp=obj)