import doctest
class A:
def param(self):
"""
>>> A().param()
2
"""
return 2
doctest.run_docstring_examples(A.param, globals()) # works fine
class B:
@property # Note: Make param a property
def param(self):
"""
>>> B().param # Note: No parentheses
B
"""
return 2
doctest.run_docstring_examples(A.param, globals()) # doesn't work on pycharm