Test a notebook containing only code cells. Given a notebook with code cells only: When ``process_notebook`` is called, Then no triple quotes should appear in the output.
(write_notebook: WriteNotebookFunc)
| 116 | |
| 117 | |
| 118 | def test_process_notebook_code_only(write_notebook: WriteNotebookFunc) -> None: |
| 119 | """Test a notebook containing only code cells. |
| 120 | |
| 121 | Given a notebook with code cells only: |
| 122 | When ``process_notebook`` is called, |
| 123 | Then no triple quotes should appear in the output. |
| 124 | """ |
| 125 | notebook_content = { |
| 126 | "cells": [ |
| 127 | {"cell_type": "code", "source": ["print('Code Cell 1')"]}, |
| 128 | {"cell_type": "code", "source": ["x = 42"]}, |
| 129 | ], |
| 130 | } |
| 131 | nb_path = write_notebook("code_only.ipynb", notebook_content) |
| 132 | result = process_notebook(nb_path) |
| 133 | |
| 134 | assert '"""' not in result, "No triple quotes expected when there are only code cells." |
| 135 | assert "print('Code Cell 1')" in result |
| 136 | assert "x = 42" in result |
| 137 | |
| 138 | |
| 139 | def test_process_notebook_markdown_only(write_notebook: WriteNotebookFunc) -> None: |
nothing calls this directly
no test coverage detected