[docs] Doctest problem
minz
amints at andromeda.ru
Thu Apr 28 13:52:54 CEST 2011
Hello!
I have a following problem (maybe it is a bug) while running this:
# coding: utf-8
class test(object):
"""
ОЛОЛО ПЫЩПЫЩ
>>> print 1 # ошибка
1
>>> obj = test()
>>> obj.raiser() # ошибка
Traceback (most recent call last):
...
Exception
"""
def __init__(self):
pass
def raiser(self):
raise Exception
if __name__ == "__main__":
import doctest
doctest.testmod()
$ python pybug.py
Traceback (most recent call last):
File "pybug.py", line 22, in <module>
doctest.testmod()
File "/usr/lib/python2.6/doctest.py", line 1848, in testmod
runner.run(test)
File "/usr/lib/python2.6/doctest.py", line 1391, in run
return self.__run(test, compileflags, out)
File "/usr/lib/python2.6/doctest.py", line 1277, in __run
got += _exception_traceback(exc_info)
File "/usr/lib/python2.6/doctest.py", line 244, in
_exception_traceback
traceback.print_exception(exc_type, exc_val, exc_tb, file=excout)
File "/usr/lib/python2.6/traceback.py", line 125, in print_exception
print_tb(tb, limit, file)
File "/usr/lib/python2.6/traceback.py", line 69, in print_tb
line = linecache.getline(filename, lineno, f.f_globals)
File "/usr/lib/python2.6/linecache.py", line 14, in getline
lines = getlines(filename, module_globals)
File "/usr/lib/python2.6/doctest.py", line 1336, in
__patched_linecache_getlines
source = example.source.encode('ascii', 'backslashreplace')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 15:
ordinal not in range(128)
The problem is in the comment in line ">>> obj.raiser() # ошибка".
Removing this comment or even moving it to previous line removes the
error.
First test (>>> print 1 # ошибка) without the second one works fine.
I have 2.6.6-5ubuntu1 installed:
$ python -V
Python 2.6.6
Regards,
Alexey Mints
More information about the docs
mailing list