Add doctest for pull request #287