diff --git a/docstring_parser/google.py b/docstring_parser/google.py index 4864393..4573dd7 100644 --- a/docstring_parser/google.py +++ b/docstring_parser/google.py @@ -103,6 +103,9 @@ def _build_meta(self, text: str, title: str) -> DocstringMeta: ) or section.type == SectionType.SINGULAR: return self._build_single_meta(section, text) + if ":" not in text: + raise ParseError("Expected a colon in {}.".format(repr(text))) + # Split spec and description before, desc = text.split(":", 1) if desc: diff --git a/docstring_parser/tests/test_google.py b/docstring_parser/tests/test_google.py index 5f71b9f..9c061fb 100644 --- a/docstring_parser/tests/test_google.py +++ b/docstring_parser/tests/test_google.py @@ -616,3 +616,14 @@ def test_unknown_meta() -> None: assert docstring.params[0].description == "desc0" assert docstring.params[1].arg_name == "arg1" assert docstring.params[1].description == "desc1" + + +def test_broken_arguments() -> None: + with pytest.raises(ParseError): + docstring = parse( + """This is a test + + Args: + param - poorly formatted + """ + )