Dynamic doctests?

2005-05-13 Thread mitchell
I'm trying to execute doc tests without writing to the filesystem (i.e. in the Python interpreter). I have something like: Docstring: n 6 # Code: n=6 import doctest doctest.testmod() The tests all pass when saving this text to a python script (as it should), but when I

Re: Dynamic doctests?

2005-05-13 Thread Sébastien Boisgérault
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 -- http://mail.python.org/mailman/listinfo/python-list