Ejemplo n.º 1
0
def test_number_extracter_doubles_letters_with_lowercase_version_with_groupletters_for_float(x):
    assume(len(x) <= 10)
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    t = float_splitter(s, True, True, False, '')
    t = [''.join([low(z) + z for z in y]) if type(y) != float else y for y in t]
    assert _number_extracter(s, _float_sign_exp_re, *float_nosafe_nolocale_group) == t
def test_parse_string_factory_parses_float_with_sign_exp_float(x):
    assume(not any(type(y) == float and isnan(y) for y in x))
    assume(all(whitespace_check(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _parse_string_factory(0, '', _float_sign_exp_re.split, no_op,
                                 fast_float, tuple2)(s) == float_splitter(
                                     s, True, True, '')
Ejemplo n.º 3
0
def test_number_extracter_inserts_empty_string_between_floats_for_py3safe_option(
        x):
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _number_extracter(s, _float_sign_exp_re,
                             *float_safe_nolocale_nogroup) == float_splitter(
                                 s, True, True, True, '')
Ejemplo n.º 4
0
def test_number_extracter_excludes_plus_sign_and_exponent_in_float_definition_for_unsigned_noexp_floats(
        x):
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _number_extracter(s, _float_nosign_noexp_re,
                             *float_nosafe_nolocale_nogroup) == float_splitter(
                                 s, False, False, False, '')
Ejemplo n.º 5
0
def test_number_extracter_doubles_letters_with_lowercase_version_with_groupletters_for_float(
        x):
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    t = float_splitter(s, True, True, False, '')
    t = [
        ''.join([low(z) + z for z in y]) if type(y) != float else y for y in t
    ]
    assert _number_extracter(s, _float_sign_exp_re,
                             *float_nosafe_nolocale_group) == t
Ejemplo n.º 6
0
def test_number_extracter_inserts_empty_string_between_floats_for_py3safe_option(x):
    assume(len(x) <= 10)
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _number_extracter(s, _float_sign_exp_re, *float_safe_nolocale_nogroup) == float_splitter(s, True, True, True, '')
Ejemplo n.º 7
0
def test_number_extracter_excludes_plus_sign_and_exponent_in_float_definition_for_unsigned_noexp_floats(x):
    assume(len(x) <= 10)
    assume(not any(type(y) == float and isnan(y) for y in x))
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _number_extracter(s, _float_nosign_noexp_re, *float_nosafe_nolocale_nogroup) == float_splitter(s, False, False, False, '')
Ejemplo n.º 8
0
def test_parse_string_factory_parses_float_with_sign_exp_float(x):
    s = ''.join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _parse_string_factory(0, '', _float_sign_exp_re.split, no_op,
                                 fast_float, tuple2)(s) == float_splitter(
                                     s, True, True, '')
Ejemplo n.º 9
0
def test_parse_string_function_parses_float_with_sign_exp_float(x):
    assume(not any(type(y) == float and isnan(y) for y in x))
    assume(all(whitespace_check(y) for y in x))
    s = "".join(repr(y) if type(y) in (float, long, int) else y for y in x)
    assert _parse_string_function(0, "", _float_sign_exp_re.split, no_op, fast_float, tuple2)(s) == float_splitter(
        s, True, True, ""
    )