def test_empty(self): def without_doc(): pass parsed = parse_docstring(without_doc) assert parsed['raw'] is None assert parsed['summary'] is None assert parsed['details'] is None assert parsed['returns'] is None assert parsed['raises'] == {} assert parsed['params'] == []
def test_single_line(self): def func(): """Some summary""" pass parsed = parse_docstring(func) assert parsed['raw'] == 'Some summary' assert parsed['summary'] == 'Some summary' assert parsed['details'] is None assert parsed['returns'] is None assert parsed['raises'] == {} assert parsed['params'] == []
def test_multi_line_and_dot(self): def func(): """ Some summary. bla bla Some details """ pass parsed = parse_docstring(func) assert parsed['raw'] == 'Some summary. bla bla\nSome details' assert parsed['summary'] == 'Some summary' assert parsed['details'] == 'bla bla\nSome details' assert parsed['returns'] is None assert parsed['raises'] == {} assert parsed['params'] == []
def test_raises(self): def func(): """ Some summary. :raises SomeException: in case of something """ pass parsed = parse_docstring(func) assert parsed[ 'raw'] == 'Some summary.\n:raises SomeException: in case of something' assert parsed['summary'] == 'Some summary' assert parsed['details'] is None assert parsed['returns'] is None assert parsed['params'] == [] assert parsed['raises'] == {'SomeException': 'in case of something'}