Skip to content

Commit

Permalink
Merge branch 'master' of github.com:stefankoegl/python-json-patch int…
Browse files Browse the repository at this point in the history
…o gh-actions
  • Loading branch information
stefankoegl committed Dec 12, 2022
2 parents 540ae48 + 714df3c commit d56942f
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 212 deletions.
7 changes: 4 additions & 3 deletions bin/jsonpatch
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ parser.add_argument('-i', '--in-place', action='store_true',
help='Modify ORIGINAL in-place instead of to stdout')
parser.add_argument('-v', '--version', action='version',
version='%(prog)s ' + jsonpatch.__version__)

parser.add_argument('-u', '--preserve-unicode', action='store_true',
help='Output Unicode character as-is without using Code Point')

def main():
try:
Expand Down Expand Up @@ -72,8 +73,8 @@ def patch_files():

# By this point we have some sort of file object we can write the
# modified JSON to.

json.dump(result, fp, indent=args.indent)
json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode))
fp.write('\n')

if args.in_place:
Expand Down
10 changes: 6 additions & 4 deletions doc/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ The program ``jsonpatch`` is used to apply JSON patches on JSON files. ::
PATCH Patch file
optional arguments:
-h, --help show this help message and exit
--indent INDENT Indent output by n spaces
-v, --version show program's version number and exit
-h, --help show this help message and exit
--indent INDENT Indent output by n spaces
-b, --backup Back up ORIGINAL if modifying in-place
-i, --in-place Modify ORIGINAL in-place instead of to stdout
-v, --version show program's version number and exit
-u, --preserve-unicode Output Unicode character as-is without using Code Point
Example
^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion ext_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _test(self, test):
raise Exception(test.get('comment', '')) from jpe

# if there is no 'expected' we only verify that applying the patch
# does not raies an exception
# does not raise an exception
if 'expected' in test:
self.assertEquals(res, test['expected'], test.get('comment', ''))

Expand Down
Loading

0 comments on commit d56942f

Please sign in to comment.