import mysteries

"Martin v. Löwis" martin at v.loewis.de
Thu Jun 21 18:10:03 EDT 2007


David Abrahams schrieb:
> I'm pretty comfortable with Python, but recently I'm constantly
> finding mysterious issues with import.  For example, looking at 
> 
>   http://genshi.edgewall.org/browser/trunk/genshi/filters/transform.py
> 
> the examples use the symbol 'HTML' but it's not defined locally, it's
> not explicitly imported, and there's no import *.  Yet doctest will
> test this module and it passes with flying colors. 

It doesn't pass for me:

py> doctest.testmod(genshi.filters.transform)
**********************************************************************
File "/usr/lib/python2.4/site-packages/genshi/filters/transform.py",
line 29, in genshi.filters.transform
Failed example:
    html = HTML('''<html>
     <head><title>Some Title</title></head>
     <body>
       Some <em>body</em> text.
     </body>
    </html>''')
Exception raised:
    Traceback (most recent call last):
      File "doctest.py", line 1248, in __run
        compileflags, 1) in test.globs
      File "<doctest genshi.filters.transform[1]>", line 1, in ?
        html = HTML('''<html>
    NameError: name 'HTML' is not defined

Regards,
Martin



More information about the Python-list mailing list