def test_license_and_copyrights(): sc = SphinxContent() with pytest.raises(ValueError): sc.register_license("x") sc.register_copyright("Copyright (C) A") assert "" == sc.content sc.add_licence_and_copyrights() assert ".. SPDX-License-Identifier: CC-BY-SA-4.0\n\n.. Copyright (C) A\n\n" == sc.content
def register_license_and_copyrights(self, content: SphinxContent): """ Registers the license and copyrights of this item. """ content.register_license(self["SPDX-License-Identifier"]) for statement in self["copyrights"]: content.register_copyright(statement)