Files
computer-playbook/tests/unit/python/utils/meta/test_authors.py
T
kevinveenbirkenbachandClaude Opus 5 353c4b87fb refactor(meta): read role names, titles and authors from one source
i18n/names kept a private _sources() that walked the role directories, read
the README heading and added galaxy_info.name. The brand rule needs the same
knowledge, and a second copy is the drift that has already bitten this branch
twice.

The three readers live under utils/meta now. titles also pins the precedence
that was implicit: the README heading wins over galaxy_info.name, because the
documentation is built from the heading. authors stays thin on purpose - the
derivation from the Credits sections belongs to utils/roles/credits, and this
is only the entry point for a reader that wants the names without the URLs.

The titles arrive sorted and deduplicated rather than in read order, which the
alternation built from them does not notice: it sorts by length itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-25 20:54:03 +02:00

31 lines
907 B
Python

from __future__ import annotations
import unittest
from utils.meta.authors import author_names
from utils.roles.credits import author_urls
from utils.software import SOFTWARE_AUTHOR
class TestAuthorNames(unittest.TestCase):
def test_the_credited_people_are_listed(self) -> None:
self.assertIn(SOFTWARE_AUTHOR, author_names())
def test_the_names_are_sorted_and_unique(self) -> None:
names = author_names()
self.assertEqual(list(names), sorted(names))
self.assertEqual(len(names), len(set(names)))
def test_it_carries_exactly_the_keys_of_the_url_map(self) -> None:
self.assertEqual(
set(author_names()),
set(author_urls()),
"the names are the map's keys, not a second list that could drift "
"from the Credits sections they are derived from",
)
if __name__ == "__main__":
unittest.main()