Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add two examples for #1247 #1248

Merged
merged 1 commit into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions tests/functional/round_trip/test_myst_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from jupytext import reads, writes
from jupytext.compare import compare
from jupytext.config import load_jupytext_configuration_file


def test_myst_header_is_stable_1247_using_inline_filter(
md="""---
jupytext:
formats: md:myst
notebook_metadata_filter: -jupytext.text_representation.jupytext_version,settings,mystnb
text_representation:
extension: .md
format_name: myst
format_version: 0.13
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
mystnb:
execution_mode: 'off'
settings:
output_matplotlib_strings: remove
---
""",
):
nb = reads(md, fmt="md")
md2 = writes(nb, fmt="md")

compare(md2, md)


def test_myst_header_is_stable_1247_using_config(
jupytext_toml_content="""notebook_metadata_filter = "-jupytext.text_representation.jupytext_version,settings,mystnb"
""",
md="""---
jupytext:
formats: md:myst
text_representation:
extension: .md
format_name: myst
format_version: 0.13
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
mystnb:
execution_mode: 'off'
settings:
output_matplotlib_strings: remove
---
""",
):
config = load_jupytext_configuration_file("jupytext.toml", jupytext_toml_content)

nb = reads(md, fmt="md", config=config)
md2 = writes(nb, fmt="md", config=config)

compare(md2, md)
Loading