Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Clément Sirieix 2026-04-21 15:19:59 +02:00 committed by GitHub
parent 95336528f6
commit 04305bd77c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
68 changed files with 3473 additions and 1764 deletions

View file

@ -2,10 +2,10 @@ from __future__ import annotations
import pytest
from vibe.core.skills.parser import SkillParseError, parse_frontmatter
from vibe.core.skills.parser import SkillParseError, parse_skill_markdown
class TestParseFrontmatter:
class TestParseSkillMarkdown:
def test_parses_valid_frontmatter(self) -> None:
content = """---
name: test-skill
@ -14,7 +14,7 @@ description: A test skill
## Body content here
"""
frontmatter, body = parse_frontmatter(content)
frontmatter, body = parse_skill_markdown(content)
assert frontmatter["name"] == "test-skill"
assert frontmatter["description"] == "A test skill"
@ -34,7 +34,7 @@ allowed-tools: bash read_file
Instructions here.
"""
frontmatter, body = parse_frontmatter(content)
frontmatter, body = parse_skill_markdown(content)
assert frontmatter["name"] == "full-skill"
assert frontmatter["description"] == "A skill with all fields"
@ -49,7 +49,7 @@ Instructions here.
content = "Just markdown content without frontmatter"
with pytest.raises(SkillParseError) as exc_info:
parse_frontmatter(content)
parse_skill_markdown(content)
assert "Missing or invalid YAML frontmatter" in str(exc_info.value)
@ -60,7 +60,7 @@ description: Missing closing delimiter
"""
with pytest.raises(SkillParseError) as exc_info:
parse_frontmatter(content)
parse_skill_markdown(content)
assert "Missing or invalid YAML frontmatter" in str(exc_info.value)
@ -74,7 +74,7 @@ Body here.
"""
with pytest.raises(SkillParseError) as exc_info:
parse_frontmatter(content)
parse_skill_markdown(content)
assert "Invalid YAML frontmatter" in str(exc_info.value)
@ -88,7 +88,7 @@ Body here.
"""
with pytest.raises(SkillParseError) as exc_info:
parse_frontmatter(content)
parse_skill_markdown(content)
assert "must be a mapping" in str(exc_info.value)
@ -98,7 +98,7 @@ Body here.
Body content.
"""
frontmatter, body = parse_frontmatter(content)
frontmatter, body = parse_skill_markdown(content)
assert frontmatter == {}
assert "Body content." in body
@ -109,7 +109,7 @@ name: minimal
description: No body
---
"""
frontmatter, body = parse_frontmatter(content)
frontmatter, body = parse_skill_markdown(content)
assert frontmatter["name"] == "minimal"
assert body.strip() == ""