Ejemplo n.º 1
0
def test_if_floating_point_recognizes_float_with_e_notation():
    assert run_parser(floating_point(), '1e1').value == 1e1
Ejemplo n.º 2
0
def test_that_floating_point_does_not_recognize_number_without_rational_part():
    with pytest.raises(ParsingFailed):
        run_parser(floating_point(), '.e1')
Ejemplo n.º 3
0
def test_if_floating_point_recognizes_custom_delimiters():
    assert run_parser(floating_point(delimiter=','), '123,12').value == 123.12
Ejemplo n.º 4
0
def test_if_floating_point_recognizes_custom_delimiters_without_integer_part():
    assert run_parser(floating_point(delimiter=','), '-,2').value == -.2
Ejemplo n.º 5
0
def test_if_floating_point_recognizes_one_sign_before_number():
    assert run_parser(floating_point(), '+1.1').value == +1.1
Ejemplo n.º 6
0
def test_if_floating_point_parses_number_without_rational_part():
    assert run_parser(floating_point(), '1.').value == 1.
Ejemplo n.º 7
0
def test_if_floating_point_parses_number_without_integer_part():
    assert run_parser(floating_point(), '.1').value == .1
Ejemplo n.º 8
0
def test_if_floating_point_parses_number_with_one_point_in_the_middle():
    assert run_parser(floating_point(), '1.1').value == 1.1
Ejemplo n.º 9
0
def test_if_floating_point_parses_simple_integer():
    assert run_parser(floating_point(), '1').value == float(1)