tests/test_hygiene.py — Approval-Gated Calendar
From version 0.1.0 of Approval-Gated Calendar, shown publicly by its creator. 2.2 KiB · SHA-256 094b3d4847c54d7a49249a7d04b87db4352a3308a6f2bc57e385a35f992366fc.
"""Package hygiene checks.
By Zero Width Lab (zerowidthlab.com)
"""
# By Zero Width Lab (zerowidthlab.com)
from __future__ import annotations
import re
import unittest
from pathlib import Path
__author__ = "Zero Width Lab"
ROOT = Path(__file__).resolve().parent.parent
SIGNATURE = "By Zero Width Lab (zerowidthlab.com)"
SHIPPED = [
"SKILL.md", "README.md", "SETUP.md", "LICENSE.txt",
"agents/approval-gated-calendar-agent.md", "references/graph-calendar.md",
"scripts/approval_gated_calendar.py", "tests/test_approval_gated_calendar.py",
"tests/test_hygiene.py", "tests/fixtures/graph-responses.json", "source-package.json",
]
class HygieneTests(unittest.TestCase):
def test_shipped_text_and_signatures(self) -> None:
invisible = [chr(value) for value in (0x200b, 0x200c, 0x200d, 0x2060, 0xfeff)]
for name in SHIPPED:
with self.subTest(name=name):
content = (ROOT / name).read_text(encoding="utf-8")
self.assertFalse(any(char in content for char in invisible))
self.assertIsNone(re.search(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", content, re.I))
self.assertIsNone(re.search("/" + "Users/[^/\\s]+|/" + "home/[^/\\s]+", content))
self.assertIsNone(re.search(r"[a-z0-9.-]+\.on" + r"microsoft\.com", content, re.I))
for email in re.findall(r"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}", content):
self.assertTrue(email.lower().endswith("@example.com"), email)
names = (
"Open" + "AI", "Anth" + "ropic", "Chat" + "G" + "PT", "Gemi" + "ni",
"Cla" + "ude", "Cod" + "ex", "Cop" + "ilot", "Son" + "net", "Op" + "us",
)
self.assertFalse(any(re.search(r"\b" + name + r"\b", content, re.I) for name in names))
self.assertIsNone(re.search(r"\b" + "G" + "PT" + r"\b", content))
if name.endswith(".md"):
self.assertEqual(content.rstrip().splitlines()[-1], SIGNATURE)
if name.endswith(".py"):
self.assertIn("# " + SIGNATURE, content.splitlines()[:6])
if __name__ == "__main__":
unittest.main()
License: MIT (read it).
MIT
MIT LicenseCopyright (c) 2026 Zero Width Lab
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.