def test_parse_docstring(): from pep257 import parse_docstring as pd d1 = '''def foo(): # o hai comment """docstring""" 2 + 2''' assert pd(d1) == '"""docstring"""' d2 = '''def foo(): # o hai comment 2 + 2''' assert pd(d2) == None assert pd("def foo():pass") == None
def test_parse_docstring(): from pep257 import parse_docstring as pd s1 = '''def foo(): # o hai comment """docstring""" 2 + 2''' assert pd(s1) == '"""docstring"""' s2 = '''def foo(): # o hai comment 2 + 2''' assert pd(s2) is None assert pd("def foo():pass") is None