thorwhalen / umpyre

Materials for python coaching
MIT License
1 stars 0 forks source link

pycharm has problems when testing a @property method #48

Open thorwhalen opened 3 years ago

thorwhalen commented 3 years ago
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