@@ -224,17 +224,33 @@ def test_markdown_handler_parses_attribute_from_header(tmp_path, attribute):
224
224
225
225
226
226
@pytest .mark .parametrize ("horizontal_rule" , ["---" , "--------" ])
227
- def test_markdown_handler_splits_header (tmp_path , horizontal_rule ):
227
+ def test_markdown_handler_splits_header (tmp_path , caplog , horizontal_rule ):
228
228
path = tmp_path / "widget.md"
229
229
path .write_text (f"{ horizontal_rule } \n order: 10\n { horizontal_rule } \n # Description" )
230
230
handler = MarkdownHandler (path )
231
231
232
- header , content = handler .split ()
232
+ with caplog .at_level (logging .WARNING , logger = "databricks.labs.lsql.dashboards" ):
233
+ header , content = handler .split ()
233
234
235
+ assert "Missing closing header boundary" not in caplog .text
234
236
assert header == "order: 10"
235
237
assert content == "# Description"
236
238
237
239
240
+ def test_markdown_handler_warns_about_open_ended_header (tmp_path , caplog ):
241
+ path = tmp_path / "widget.md"
242
+ body = "---\n order: 1\n # Description"
243
+ path .write_text (body )
244
+ handler = MarkdownHandler (path )
245
+
246
+ with caplog .at_level (logging .WARNING , logger = "databricks.labs.lsql.dashboards" ):
247
+ header , content = handler .split ()
248
+
249
+ assert "Missing closing header boundary." in caplog .text
250
+ assert len (header ) == 0
251
+ assert content == body
252
+
253
+
238
254
def test_widget_metadata_replaces_width_and_height (tmp_path ):
239
255
path = tmp_path / "test.sql"
240
256
path .write_text ("SELECT 1" )
0 commit comments