doctest bug with nested triple quotes

Michele Simionato michele.simionato at gmail.com
Tue Aug 2 06:41:36 CEST 2005


I am getting trouble with nested triple quoted strings in doctest.
For instance

$ cat x.py
"""
>>> dummy = '''
something
here
'''
"""
import doctest; doctest.testmod()

$ python x.py

**********************************************************************
File "x.py", line 2, in __main__
Failed example:
    dummy = '''
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.4/doctest.py", line 1243, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__[0]>", line 1
         dummy = '''
                  ^
     SyntaxError: EOF while scanning triple-quoted string
**********************************************************************

Is this a know bug? Any workaround? Thanks for comments,


                     Michele Simionato




More information about the Python-list mailing list