Dynamic doctests?

Sébastien Boisgérault Sebastien.Boisgerault at gmail.com
Fri May 13 13:21:17 EDT 2005


>
>   code='"""\n>>> n\n6\n"""\nn=6\nimport doctest\ndoctest.testmod()'
>   exec(code)
>

Remove 'doctest.tesmod()' and the import from your 'code' string.

]]] exec(code)
]]] import doctest
]]] doctest.testmod()

should do the trick.

Cheers,

SB




More information about the Python-list mailing list