~reviewer/hello-hut

ref: HEAD hello-hut/tests/test_phrasebook.py -rw-r--r-- 628 bytes
c72c9ea1 — Sam Lindqvist docs: point to the mailing lists and the tracker 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""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)