feat(okf): add okf_validate; harden YAML parser for block lists + folded scalars
Verified conformant against Google reference bundles (crypto_bitcoin, ga4, stackoverflow). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,21 @@ class TestFrontmatter(unittest.TestCase):
|
||||
def test_empty_list(self):
|
||||
self.assertEqual(parse_yaml_subset("tags: []")["tags"], [])
|
||||
|
||||
def test_block_list(self):
|
||||
raw = "type: BigQuery Dataset\ntags:\n- cryptocurrency\n- bitcoin\n- public data\ntimestamp: '2026-05-28T22:44:47+00:00'"
|
||||
meta = parse_yaml_subset(raw)
|
||||
self.assertEqual(meta["tags"], ["cryptocurrency", "bitcoin", "public data"])
|
||||
self.assertEqual(meta["timestamp"], "2026-05-28T22:44:47+00:00")
|
||||
|
||||
def test_folded_multiline_scalar(self):
|
||||
raw = "description: This dataset contains a complete history of the Bitcoin\n blockchain and updates every 10 minutes.\ntype: BigQuery Dataset"
|
||||
meta = parse_yaml_subset(raw)
|
||||
self.assertEqual(
|
||||
meta["description"],
|
||||
"This dataset contains a complete history of the Bitcoin blockchain and updates every 10 minutes.",
|
||||
)
|
||||
self.assertEqual(meta["type"], "BigQuery Dataset")
|
||||
|
||||
def test_no_frontmatter(self):
|
||||
meta, body = parse_frontmatter("# Just markdown\n")
|
||||
self.assertIsNone(meta)
|
||||
|
||||
Reference in New Issue
Block a user