| 1 | import jupytext |
| 2 | from jupytext.comparescip-python python jupytext 1.16.4 `jupytext.compare`/__init__: import compare |
| 3 | |
| 4 | |
| 5 | def test_identity_write_readscip-python python jupytext 1.16.4 `tests.functional.round_trip.test_rmd_to_ipynb`/test_identity_write_read().(rmd_filescip-python python jupytext 1.16.4 `tests.functional.round_trip.test_rmd_to_ipynb`/test_identity_write_read().(rmd_file), no_jupytext_version_numberscip-python python jupytext 1.16.4 `tests.functional.round_trip.test_rmd_to_ipynb`/test_identity_write_read().(no_jupytext_version_number)): |
| 6 | """Test that writing the notebook with ipynb, and read again, yields identity""" |
| 7 | |
| 8 | with openscip-python python python-stdlib 3.11 builtins/open().(rmd_filescip-python python jupytext 1.16.4 `tests.functional.round_trip.test_rmd_to_ipynb`/test_identity_write_read().(rmd_file)) as fp: |
| 9 | rmd = fp.readscip-python python python-stdlib 3.11 io/TextIOBase#read().() |
| 10 | |
| 11 | nb = jupytext.reads(rmd, "Rmd") |
| 12 | rmd2 = jupytext.writes(nb, "Rmd") |
| 13 | |
| 14 | compare(rmd2, rmd) |
| 15 | |
| 16 | |
| 17 | def test_two_blank_lines_as_cell_separatorscip-python python jupytext 1.16.4 `tests.functional.round_trip.test_rmd_to_ipynb`/test_two_blank_lines_as_cell_separator().(): |
| 18 | rmd = """Some markdown |
| 19 | text |
| 20 | |
| 21 | |
| 22 | And a new cell |
| 23 | """ |
| 24 | |
| 25 | nb = jupytext.reads(rmd, "Rmd") |
| 26 | assert len(nb.cells) == 2 |
| 27 | assert nb.cells[0].cell_type == "markdown" |
| 28 | assert nb.cells[1].cell_type == "markdown" |
| 29 | assert nb.cells[0].source == "Some markdown\ntext" |
| 30 | assert nb.cells[1].source == "And a new cell" |