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