We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm porting an application to Python 3. I have some (old) functional tests like this:
>>> print(http(b"GET /someurl HTTP/1.1")) HTTP/1.1 200 Ok ... <p>blah blah 360° blah blah ...
The ° is encoded in UTF-8 on disk. This works on Python 2, where everything is bytes.
°
On Python 3 I'm getting this problem:
- <p>blah blah 360° blah blah + <p>blah blah 360° blah blah
because zope.app.wsgi.testlayer.FakeResponse.__str__ is defined, on Python 3, to return
zope.app.wsgi.testlayer.FakeResponse.__str__
def __str__(self): return self.getOutput().decode('latin-1')
Meanwhile the Python 3 doctest module defaults to interpreting doctests as being in UTF-8 if no explicit encoding has been provided.
What can we do to make things work out of the box?
The text was updated successfully, but these errors were encountered:
I'm considering self.getOutput().decode(self.response.charset or 'latin-1').
self.getOutput().decode(self.response.charset or 'latin-1')
(The or 'latin-1' is because for responses that return e.g. image/png, self.response.charset will be None, and str.decode() does not like None.)
or 'latin-1'
None
Sorry, something went wrong.
No branches or pull requests
I'm porting an application to Python 3. I have some (old) functional tests like this:
The
°
is encoded in UTF-8 on disk. This works on Python 2, where everything is bytes.On Python 3 I'm getting this problem:
because
zope.app.wsgi.testlayer.FakeResponse.__str__
is defined, on Python 3, to returnMeanwhile the Python 3 doctest module defaults to interpreting doctests as being in UTF-8 if no explicit encoding has been provided.
What can we do to make things work out of the box?
The text was updated successfully, but these errors were encountered: