diff --git a/papyri/gen.py b/papyri/gen.py index 6f2f1df3..5f2f7d51 100644 --- a/papyri/gen.py +++ b/papyri/gen.py @@ -1541,8 +1541,10 @@ def prepare_doc_for_one_object( else: assert blob is not None assert api_object is not None - - blob.textsignature = TextSignature(str(api_object.signature)) + if api_object.signature is None: + blob.textsignature = TextSignature(None) + else: + blob.textsignature = TextSignature(str(api_object.signature)) del blob.content["Signature"] self.log.debug("%r", blob.textsignature) diff --git a/papyri/tests/test_gen.py b/papyri/tests/test_gen.py index 94b6943d..d49eda8f 100644 --- a/papyri/tests/test_gen.py +++ b/papyri/tests/test_gen.py @@ -103,8 +103,12 @@ def test_self(): c = Config(dry_run=True, dummy_progress=True) g = Gen(False, config=c) g.collect_package_metadata("papyri", ".", {}) - g.collect_api_docs("papyri", {"papyri.examples:example1"}) + g.collect_api_docs("papyri", {"papyri.examples:example1", "papyri"}) assert g.data["papyri.examples:example1"].to_dict()["textsignature"] == { "type": "TextSignature", "value": "(pos, only, /, var, args, *, kwargs, also=None)", } + assert g.data["papyri"].to_dict()["textsignature"] == { + "type": "TextSignature", + "value": None, + }