Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue2811] doctest doesn't treat unicode literals as specified by the file declared encoding

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

May 10, 2008, 11:47 AM

Post #1 of 1 (32 views)
Permalink
[issue2811] doctest doesn't treat unicode literals as specified by the file declared encoding

New submission from Paulo Eduardo Neves <pauloneves[at]gmail.com>:

Doctest doesn't obey the specified file encoding for unicode literals.

I've put the minimum test case that demonstrate the error in the
attached file.

The program has the # -*- coding: utf-8 -*- as the first line and is
saved in this encoding. My computer environment is configured as
iso8859-1. Doctest ignores the file encoding specification and
interprets the u'á' as u'á' (the utf-8 text decoded as iso8859-1 )

I've reproduced this error in python 2.5 in linux and windows.


This is the output of the program below that runs the function normalize
from inside doctest and directly from python. They show different results.

**********************************************************************
File "doctesteerror.py", line 7, in __main__.normalize
Failed example:
normalize(u'á')
Expected:
u'b'
Got:
u'\xc3\xa1'
**********************************************************************
1 items had failures:
1 of 1 in __main__.normalize
***Test Failed*** 1 failures.
without doctest ===>>> b

----------
components: Library (Lib)
files: doctesteerror.py
messages: 66559
nosy: neves
severity: normal
status: open
title: doctest doesn't treat unicode literals as specified by the file declared encoding
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file10265/doctesteerror.py

__________________________________
Tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue2811>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.