Example #1
0
def test_if_floating_point_recognizes_float_with_e_notation():
    assert run_parser(floating_point(), '1e1').value == 1e1
Example #2
0
def test_that_floating_point_does_not_recognize_number_without_rational_part():
    with pytest.raises(ParsingFailed):
        run_parser(floating_point(), '.e1')
Example #3
0
def test_if_floating_point_recognizes_custom_delimiters():
    assert run_parser(floating_point(delimiter=','), '123,12').value == 123.12
Example #4
0
def test_if_floating_point_recognizes_custom_delimiters_without_integer_part():
    assert run_parser(floating_point(delimiter=','), '-,2').value == -.2
Example #5
0
def test_if_floating_point_recognizes_one_sign_before_number():
    assert run_parser(floating_point(), '+1.1').value == +1.1
Example #6
0
def test_if_floating_point_parses_number_without_rational_part():
    assert run_parser(floating_point(), '1.').value == 1.
Example #7
0
def test_if_floating_point_parses_number_without_integer_part():
    assert run_parser(floating_point(), '.1').value == .1
Example #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
Example #9
0
def test_if_floating_point_parses_simple_integer():
    assert run_parser(floating_point(), '1').value == float(1)