Repository object · test

Test License

Accepted test in the public catalog.

Source path
tests/test_license.py
Media type
text/x-python
Object ID
em:test:sha256:b019d0a8d15fb08b000b90c4b84d09fe2c76d8c8973aaa073917b5ad44f46a68
Content digest
ac06ef40683e4b97b3e41163c668a0564d701caefb033d05bc4cf92b12bf778f

Source content

from __future__ import annotations

import hashlib

import tomllib

from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]

APACHE_2_LICENSE_SHA256 = "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30"

def test_license_is_canonical_apache_2() -> None:

assert hashlib.sha256((ROOT / "LICENSE").read_bytes()).hexdigest() == APACHE_2_LICENSE_SHA256

def test_package_and_readme_license_metadata_agree() -> None:

project = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"]

assert project["license"] == "Apache-2.0"

assert project["license-files"] == ["LICENSE"]

assert not any(item.startswith("License ::") for item in project["classifiers"])

readme = (ROOT / "README.md").read_text()

assert "Code is licensed under the Apache License 2.0." in readme

Build receipt

Reproduce this projection

Reproducible projection
Catalog
em:catalog:sha256:9bfc972213cba2cde167386103dc2c011ee74639fb7f0794c54120fbbdef1a5d
Frontier
em:frontier:sha256:f33be3eae4c75232d56750ef9a1aa79d96274ece3417d65a75c1391bf61a81bf
Accepted commit
f92846570180dfa4511263f8ba98ecd18f7772c9
Epistemic policy
commons-balanced-v0.1
Disclosure policy
public-noninterference-v0.1
Compiler
epistemedia/0.2.0