Skip to content

Commit

Permalink
fix tests for py2
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Jun 16, 2018
1 parent 5c43c5f commit 6d8eea6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions plone/namedfile/marshaler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Let's now use this message to construct a new object::
>>> newContent._file.contentType
'text/plain'
>>> newContent._file.filename
u'test.txt'
'test.txt'

>>> newContent._image is None
True
Expand Down Expand Up @@ -212,11 +212,11 @@ Of course, we will also be able to load this data from a message::
>>> newContent._file.contentType
'text/plain'
>>> newContent._file.filename
u'test.txt'
'test.txt'

>>> newContent._image.data == zptlogo
True
>>> newContent._image.contentType
'image/gif'
>>> newContent._image.filename
u'zptl\xf8go.gif'
'zptl\xf8go.gif'
3 changes: 2 additions & 1 deletion plone/namedfile/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from plone.testing import layered

import doctest
import re
import six
import unittest

Expand All @@ -18,7 +19,7 @@ class Py23DocChecker(doctest.OutputChecker):
def check_output(self, want, got, optionflags):
if six.PY2:
got = re.sub('zExceptions.NotFound', 'NotFound', got)
got = re.sub("u'(.*?)'", "'\\1'", want)
got = re.sub("u'(.*?)'", "'\\1'", got)
got = re.sub(
r"WrongType: \('(.*?)', <type 'unicode'>, '(.*?)'\)",
r"zope.schema._bootstrapinterfaces.WrongType: (b'\1', <class 'str'>, '\2')", # noqa E508
Expand Down

0 comments on commit 6d8eea6

Please sign in to comment.