Skip to content

Commit

Permalink
Reproduce and fix #792
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed May 29, 2021
1 parent 1d63611 commit 233b9cd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Jupytext ChangeLog
==================

1.11.3 (2021-05-??)
1.11.3 (2021-06-??)
-------------------

**Fixed**
- Dependencies of the JupyterLab extension have been upgraded to fix a security vulnerability ([#783](https://github.com/mwouts/jupytext/issues/783))
- Fixed a round-trip issue on notebooks that have None/null in their metadata ([#792](https://github.com/mwouts/jupytext/issues/792))

1.11.2 (2021-05-02)
-------------------
Expand Down
2 changes: 1 addition & 1 deletion jupytext/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def recursive_update(target, update):
for key in update:
value = update[key]
if value is None:
del target[key]
target.pop(key, None)
elif isinstance(value, dict):
target[key] = recursive_update(target.get(key, {}), value)
else:
Expand Down
16 changes: 16 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,3 +1311,19 @@ def test_jupytext_to_ipynb_does_not_update_timestamp_if_not_paired(

capture = capsys.readouterr()
assert "Updating the timestamp" not in capture.out


def test_round_trip_with_null_metadata_792(tmpdir, cwd_tmpdir, python_notebook):
nb = python_notebook
nb.metadata.kernelspec = {
"argv": ["python", "-m", "ipykernel_launcher", "-f", "{connection_file}"],
"display_name": "Python 3",
"env": None,
"interrupt_mode": "signal",
"language": "python",
"metadata": None,
"name": "python3",
}
write(nb, "test.ipynb")
jupytext(["--to", "py:percent", "test.ipynb"])
jupytext(["--to", "ipynb", "test.py"])

0 comments on commit 233b9cd

Please sign in to comment.