doctest + sqlobject (TDD)

petr.jakes.tpc at gmail.com petr.jakes.tpc at gmail.com
Sat Dec 22 13:58:11 EST 2007


On Dec 22, 7:05 pm, Peter Otten <__pete... at web.de> wrote:
> petr.jakes.tpc wrote:
While you could either alter the textfile to
>
> >>> import __main__ as displeje_pokus
>
> or the module along the lines of
>
> # not recommended!
> from displeje_pokus import TextyDispleje
> if __name__ == "__main__":
>    # doctest
> else:
>    class TextyDispleje(SQLObject):
>        pass
>
> the clean way to fix the problem is to use a separate script to invoke the
> doctest.
>
> Peter

Peter,

thanks for your reply. I will try to live with the

>>> import __main__ as displeje_pokus

in the text file.

Anyway, using this, it looks like I have to assign all functions/
methods to a local name like:

myFunction=displeje_pokus.myFunction

to avoid to write modul name (displeje_pokus) in front of the each
function/method calling.

Do you think there is a way how to protect the text file contents
against such a "assigning hell"?

Petr



More information about the Python-list mailing list