diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-03-27 14:58:02 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-03-27 14:58:02 +0000 |
| commit | 30236682bfe220c79c4fdc0bea66f2f0e06f1fd4 (patch) | |
| tree | 744401d5d3c85c1a938f1c38df188a80e85496b7 | |
| parent | 72f52a18069c2a04b9cb8bbe6f5185fe4c384be1 (diff) | |
Rename raw_output to text_output
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | jq.pyx | 4 | ||||
| -rw-r--r-- | tests/jq_tests.py | 8 |
3 files changed, 8 insertions, 8 deletions
@@ -18,10 +18,10 @@ If the value is unparsed JSON text, pass it in using the `text` argument: jq(".").transform(text="42") == 42 ``` -The `raw_output` argument can be used to serialise the output into a JSON string: +The `text_output` argument can be used to serialise the output into JSON text: ```python -jq(".").transform("42", raw_output=True) == '"42"' +jq(".").transform("42", text_output=True) == '"42"' ``` The `multiple_output` argument can be used for cases when multiple output elements are expected: @@ -112,7 +112,7 @@ cdef class _Program(object): def __dealloc__(self): jq_teardown(&self._jq) - def transform(self, value=_NO_VALUE, text=_NO_VALUE, raw_output=False, multiple_output=False): + def transform(self, value=_NO_VALUE, text=_NO_VALUE, text_output=False, multiple_output=False): if (value is _NO_VALUE) == (text is _NO_VALUE): raise ValueError("Either the value or text argument should be set") string_input = text if text is not _NO_VALUE else json.dumps(value) @@ -126,7 +126,7 @@ cdef class _Program(object): raise ValueError(self._error_store.error_string()) result_strings = map(lambda s: s.decode("utf8"), result_bytes) - if raw_output: + if text_output: return "\n".join(result_strings) elif multiple_output: return [json.loads(s) for s in result_strings] diff --git a/tests/jq_tests.py b/tests/jq_tests.py index daa7f85..c7ffd01 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -30,18 +30,18 @@ def input_string_is_parsed_to_json_if_raw_input_is_true(): @istest -def output_is_serialised_to_json_string_if_raw_output_is_true(): +def output_is_serialised_to_json_string_if_text_output_is_true(): assert_equal( '"42"', - jq(".").transform("42", raw_output=True) + jq(".").transform("42", text_output=True) ) @istest -def elements_in_raw_output_are_separated_by_newlines(): +def elements_in_text_output_are_separated_by_newlines(): assert_equal( "1\n2\n3", - jq(".[]").transform([1, 2, 3], raw_output=True) + jq(".[]").transform([1, 2, 3], text_output=True) ) |
