doctest + sqlobject (TDD)

Peter Otten __peter__ at web.de
Sat Dec 22 15:06:38 EST 2007


petr.jakes.tpc wrote:

> thanks for your reply. I will try to live with the
> 
>>>> import __main__ as displeje_pokus
> 
> in the text file.

Why?
 
> 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"?

This has nothing to do with your previous problem. Use

from __main__ import myFunction, myOtherFunction, ...

or

from __main__ import *

if you prefer "namespace pollution paradise"*.

Again, it would be better to move the doctest.testfile() call into a
separate script.

Peter

(*) which I'm tempted to write "namespace 'pollution' paradise" or
"namespace pollution 'paradise'", but don't, for fear of "quoting hell".



More information about the Python-list mailing list