diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-03-02 10:52:39 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-03-02 10:52:39 +0000 |
| commit | 37c6f8a5cbb2cfc4cd9726ebc82c1ced7c7b2604 (patch) | |
| tree | a9360a5d1c8664c2f6e349e0cd2736965e7c7685 /tests/jq_tests.py | |
| parent | 76525df1ba37edf8dda6450a269f27e349d41613 (diff) | |
Handle non-string errors with constant
Diffstat (limited to 'tests/jq_tests.py')
| -rw-r--r-- | tests/jq_tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/jq_tests.py b/tests/jq_tests.py index 81eb79b..69c37df 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -217,6 +217,16 @@ def test_value_error_is_raised_if_input_cannot_be_processed_by_program(): assert_equal(str(error), expected_error_str) +def test_non_string_error_is_converted_to_generic_string(): + program = jq.compile("error") + try: + program.input(1).all() + assert False, "Expected error" + except ValueError as error: + expected_error_str = "(not a string)" + assert_equal(str(error), expected_error_str) + + def test_errors_do_not_leak_between_transformations(): program = jq.compile(".x") try: |
