Exemple #1
0
def sleep_wrapper(sleep_second, dry_run=False):
    import time

    if sleep_second == float("inf"):
        # Process to maintain consistency between OS
        #   linux: raise IOError
        #   windows: raise OverflowError
        raise OverflowError("sleep length is too large")

    if dataproperty.is_nan(sleep_second):
        # Process to maintain consistency between OS
        #   linux: raise IOError
        #   windows: not raise exception
        raise IOError("Invalid argument")

    sleep_second = float(sleep_second)
    if sleep_second <= 0:
        return 0

    if dry_run:
        return 0

    time.sleep(sleep_second)

    return sleep_second
Exemple #2
0
 def test_abnormal_1(self, dividend, divisor):
     assert dataproperty.is_nan(safe_division(dividend, divisor))
 def test_abnormal(self):
     assert is_nan(convert_value(nan))
 def test_abnormal(self):
     assert is_nan(convert_value(nan))