Skip to content

gh-131178: Add more tests for json command-line interface#149868

Open
Ar-maan05 wants to merge 1 commit into
python:mainfrom
Ar-maan05:gh-131178-json-cli-tests
Open

gh-131178: Add more tests for json command-line interface#149868
Ar-maan05 wants to merge 1 commit into
python:mainfrom
Ar-maan05:gh-131178-json-cli-tests

Conversation

@Ar-maan05
Copy link
Copy Markdown

Adds tests for previously-uncovered paths of the json / json.tool CLI:

  • invalid JSON input on stdin
  • empty stdin input
  • missing input file
  • unknown CLI option
  • --indent + --tab (mutually exclusive)
  • --compact + --no-indent (mutually exclusive)
  • --json-lines + --compact (valid JSONL output)
  • --json-lines + --no-indent (valid JSONL output)
  • invalid line inside --json-lines mode

All tests inherit through TestTool(TestMain) so they run for both
python -m json and python -m json.tool.

Cover error paths (invalid JSON input, missing input file, unknown and mutually exclusive options) and --json-lines combined with --compact or --no-indent.
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant