diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-03-27 14:13:04 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-03-27 14:13:04 +0000 |
| commit | c09350f5016796ee76d2e43f174cce2fdb672ddd (patch) | |
| tree | 6fbab141cee745927d832453f7015466a2b1d648 /tests | |
| parent | d9cae8c701c21d401551ed1d551ced7324fd7114 (diff) | |
Capture invalid input errors
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/jq_tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/jq_tests.py b/tests/jq_tests.py index 3bf7ffb..0a3aca7 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -105,6 +105,17 @@ def errors_do_not_leak_between_transformations(): @istest +def value_error_is_raised_if_input_is_not_valid_json(): + program = jq(".x") + try: + program.transform("!!", raw_input=True) + assert False, "Expected error" + except ValueError as error: + expected_error_str = "parse error: Invalid numeric literal\n" + assert_equal(str(error), expected_error_str) + + +@istest def unicode_strings_can_be_used_as_input(): assert_equal( u"‽", |
