Skip to content

Commit 5ffecfa

Browse files
author
Zo Bot
committed
add --format-options tests for negative integer values
parse_format_options already accepts negative integers (the try/except int(value) path was
1 parent 7c1de49 commit 5ffecfa

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/test_output.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ def test_json_formatting_options(self, options: str, expected_json: str):
426426
({'foo': {'bar': 1}}, 'foo.bar:2', {'foo': {'bar': 2}}),
427427
({'foo': {'bar': True}}, 'foo.bar:false', {'foo': {'bar': False}}),
428428
({'foo': {'bar': 'a'}}, 'foo.bar:b', {'foo': {'bar': 'b'}}),
429+
# int() accepts a leading minus, so a negative integer should
430+
# round-trip through the same try/except int(value) branch.
431+
({'foo': {'bar': 1}}, 'foo.bar:-2', {'foo': {'bar': -2}}),
432+
({'foo': {'bar': 0}}, 'foo.bar:-1', {'foo': {'bar': -1}}),
429433
# @formatter:on
430434
]
431435
)

0 commit comments

Comments
 (0)