"""The packaged copies of the stylesheet and the DTD, against their originals. The validator has to find both when it is installed as a wheel with nothing but the package on disk, so mews/data holds copies. They must not drift. """ from importlib import resources from pathlib import Path ROOT = Path(__file__).resolve().parent.parent COPIES = { "mews-0.1.css": ROOT / "mews-0.1.css", "mews-0.1.dtd": ROOT / "dtd" / "mews-0.1.dtd", } def test_packaged_copies_match_the_originals(): for name, original in COPIES.items(): packaged = resources.files("mews.data").joinpath(name).read_bytes() assert packaged == original.read_bytes(), ( f"mews/data/{name} differs from {original}. Copy the original over it." ) def test_the_spec_quotes_the_same_stylesheet(): """SPEC.md 5.1 prints the stylesheet in full; it has to be the same file.""" spec = (ROOT / "doc" / "SPEC.md").read_text() quoted = spec.split("```css\n", 1)[1].split("```", 1)[0] assert quoted.strip() == (ROOT / "mews-0.1.css").read_text().strip()