Skip to content

Commit

Permalink
Test for expected failure when input file is not valid JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
kynan committed Feb 5, 2024
1 parent c59d106 commit 0dc1cae
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions tests/e2e_notebooks/test_invalid_json.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5c42035d",
"metadata": {},
"source": [
"This notebook is not valid JSON."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
}
},
"nbformat": 4,
"nbformat_minor": 5,
}
3 changes: 2 additions & 1 deletion tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

ERR_OUTPUT_CASES = [
("test_metadata.ipynb", ["Ignoring invalid extra key `invalid`", "Ignoring invalid extra key `foo.invalid`"], ["--extra-keys", "invalid foo.invalid"]),
("test_metadata_exception.ipynb", [re.compile(".*MetadataError: cell metadata contradicts tags: `keep_output` is false, but `keep_output` in tags")], [])
("test_metadata_exception.ipynb", [re.compile(".*MetadataError: cell metadata contradicts tags: `keep_output` is false, but `keep_output` in tags")], []),
("test_invalid_json.ipynb", ["No valid notebook detected on stdin"], []),
]


Expand Down

0 comments on commit 0dc1cae

Please sign in to comment.