Example #1
0
def test_json_number_can_handle_negative_exponents():
    assert (run_parser(json_number(), '1.54e-2').value == float('1.54e-2'))
Example #2
0
def test_json_number_raises_when_period_without_fraction():
    with pytest.raises(ParsingFailed):
        run_parser(json_number(), '1.')
Example #3
0
def test_json_number_can_handle_exponents():
    assert run_parser(json_number(), '1e+0').value == float('1e+0')
Example #4
0
def test_json_number_can_handle_floats():
    run_parser(json_number(), '1.1').value == 1.1
Example #5
0
def test_json_number_can_handle_leading_minus():
    run_parser(json_number(), '-1').value == -1
Example #6
0
def test_json_number_raises_with_leading_zero():
    with pytest.raises(ParsingFailed):
        run_parser(json_number(), '01')
Example #7
0
def test_json_number_can_handle_two_digit_string():
    assert run_parser(json_number(), '45').value == 45
Example #8
0
def test_json_number_can_handle_0_string():
    assert run_parser(json_number(), '0').value == 0