File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,8 @@ def _create_analysis_notebook(self) -> nbformat.NotebookNode:
124124
125125 # Title
126126 nb .cells .append (nbformat .v4 .new_markdown_cell ("# NetGraph Results Analysis" ))
127+ # Subtitle: show the results file name used to build this notebook
128+ nb .cells .append (nbformat .v4 .new_markdown_cell (f"### { self .results_path .name } " ))
127129
128130 # Setup
129131 nb .cells .append (self ._create_setup_cell ())
Original file line number Diff line number Diff line change @@ -236,3 +236,36 @@ def test_create_analysis_sections_with_registry(results_file):
236236 # Verify markdown and code cells were created
237237 assert mock_nbformat .v4 .new_markdown_cell .call_count > 0
238238 assert mock_nbformat .v4 .new_code_cell .call_count > 0
239+
240+
241+ def test_notebook_subtitle_matches_results_file (tmp_path : Path ) -> None :
242+ """Notebook should include a subtitle with the results filename."""
243+ # Create a deterministic results file name
244+ results_path = tmp_path / "baseline_run.json"
245+ results_path .write_text (
246+ json .dumps (
247+ {
248+ "workflow" : {
249+ "step1" : {
250+ "step_type" : "NetworkStats" ,
251+ "step_name" : "step1" ,
252+ "execution_order" : 0 ,
253+ }
254+ },
255+ "steps" : {"step1" : {"data" : {}}},
256+ }
257+ )
258+ )
259+
260+ generator = ReportGenerator (results_path )
261+ generator .load_results ()
262+
263+ nb = generator ._create_analysis_notebook ()
264+
265+ # First two cells are title and subtitle
266+ assert len (nb .cells ) >= 2
267+ assert nb .cells [0 ].cell_type == "markdown"
268+ assert "# NetGraph Results Analysis" in nb .cells [0 ]["source" ]
269+
270+ assert nb .cells [1 ].cell_type == "markdown"
271+ assert nb .cells [1 ]["source" ] == f"### { results_path .name } "
You can’t perform that action at this time.
0 commit comments