Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse_none_docstring(docstring):
"""Check ``parse_docstring`` returns empty dict on empty input."""
assert parser.parse_docstring(docstring) == {}
def test_parse_docstring_special_characters():
"""Check ``parse_docstring`` parser result."""
docstring = """
Description with an special character like é
:field1: value with an special character like é
"""
assert parser.parse_docstring(docstring) == {
u'field1': u'value with an special character like é',
}
return
# Parse package, module, class and function docstrings. Every loop
# updates the already defined fields. The order of processing ensures
# that function docstring has more priority over class and module and
# package docstrings respectively.
docstrings = [
self.pkginit_docstring,
self.module_docstring,
self.class_docstring,
self.docstring,
]
for docstring in docstrings:
if docstring and not isinstance(docstring, type(u'')):
docstring = docstring.decode('utf-8')
self.fields.update(parse_docstring(docstring))