[Numpy-discussion] numpydoc for python 3?
Wed Jan 16 05:32:33 CST 2013
On 01/14/2013 02:44 PM, Matthew Brett wrote:
> On Mon, Jan 14, 2013 at 10:35 AM, Jaakko Luttinen
> <email@example.com> wrote:
>> On 01/14/2013 12:53 AM, Matthew Brett wrote:
>>> You might be able to get away without 2to3, using the kind of stuff
>>> that Pauli has used for scipy recently:
>> Ok, thanks, maybe I'll try to make the tests valid in all Python
>> versions. It seems there's only one line which I'm not able to transform.
>> In doc/sphinxext/tests/test_docscrape.py, on line 559:
>> assert doc['Summary'] == u'öäöäöäöäöåååå'.encode('utf-8')
>> This is invalid in Python 3.0-3.2. How could I write this in such a way
>> that it is valid in all Python versions? I'm a bit lost with these
>> unicode encodings in Python (and in general).. And I didn't want to add
>> dependency on 'six' package.
> Pierre's suggestion is good; you can also do something like this:
> # -*- coding: utf8 -*-
> import sys
> if sys.version_info >= 3:
> a = 'öäöäöäöäöåååå'
> a = unicode('öäöäöäöäöåååå', 'utf8')
> The 'coding' line has to be the first or second line in the file.
Thanks for all the comments!
I reported an issue and made a pull request:
However, I haven't been able to make nosetests work. I get error:
"ValueError: Attempted relative import in non-package"
Don't know how to fix it properly..
More information about the NumPy-Discussion