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