Skip to content

Commit

Permalink
Reproduce and fix #792 (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts authored May 30, 2021
1 parent ba932cd commit b759a77
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,7 +1,7 @@
Jupytext ChangeLog
==================

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

**Changed**
Expand All @@ -10,6 +10,7 @@ Jupytext ChangeLog
**Fixed**
- Dependencies of the JupyterLab extension have been upgraded to fix a security vulnerability ([#783](https://github.com/mwouts/jupytext/issues/783))
- Variables assigned from a magic command are commented out in `py` scripts ([#781](https://github.com/mwouts/jupytext/issues/781))
- 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 @@ -1360,3 +1360,19 @@ def test_use_source_timestamp(tmpdir, cwd_tmpdir, python_notebook, capsys, forma
cm.get("test.ipynb")
else:
cm.get("test.ipynb")


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 b759a77

Please sign in to comment.