"""Snapshot test: every line of fixtures/phrasebook.txt must round-trip."""
import pathlib
import unittest
from hello_hut.greetings import greet
FIXTURE = pathlib.Path(__file__).parent / "fixtures" / "phrasebook.txt"
class PhrasebookTest(unittest.TestCase):
def test_phrasebook(self):
for line in FIXTURE.read_text(encoding="utf-8").splitlines():
if not line or line.startswith("#"):
continue
style, name, expected = line.split("\t")
with self.subTest(name=name, style=style):
self.assertEqual(greet(name, shout=(style == "shout")), expected)