Skip to content

Instantly share code, notes, and snippets.

@osantana
Last active August 29, 2015 13:58
Show Gist options
  • Save osantana/10216770 to your computer and use it in GitHub Desktop.
Save osantana/10216770 to your computer and use it in GitHub Desktop.
Bug(?) in Python doctest
#!/usr/bin/env python
# coding: utf-8
"""
The following test should pass, but it fails:
>>> def spam():
... print("eggs")
...
>>> assert spam(), "Print 'eggs' before AssertionError"
eggs
Traceback (most recent call last):
...
AssertionError: Print 'eggs' before AssertionError
"""
import doctest
if __name__ == "__main__":
doctest.testmod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment