# Copyright 2026 Emile de Bruyn # SPDX-License-Identifier: Apache-2.0 import hashlib import sys import unittest from pathlib import Path import yaml ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "scripts")) from build_croissant import AUTHORS class AttributionTests(unittest.TestCase): def test_scientific_author_order_and_software_author(self): citation = yaml.safe_load((ROOT / "CITATION.cff").read_text()) authors = citation["preferred-citation"]["authors"] self.assertEqual([f"{a['given-names']} {a['family-names']}" for a in authors], AUTHORS) self.assertEqual(citation["authors"], authors) self.assertIn('authors = [{ name = "Emile de Bruyn" }]', (ROOT / "construction/pyproject.toml").read_text()) def test_code_license_and_source_notices(self): apache = (ROOT / "LICENSE-APACHE-2.0").read_bytes() self.assertEqual(hashlib.sha256(apache).hexdigest(), "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30") for directory in ("construction/motifbench_prosite", "construction/tests", "scripts", "tests"): for path in (ROOT / directory).glob("*.py"): text = path.read_text() self.assertIn("# Copyright 2026 Emile de Bruyn\n", text, path) self.assertIn("# SPDX-License-Identifier: Apache-2.0\n", text, path) self.assertIn("Copyright 2026 Emile de Bruyn", (ROOT / "LICENSE").read_text()) self.assertNotIn("Anonymous Authors", (ROOT / "LICENSE").read_text()) if __name__ == "__main__": unittest.main()