testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #00709
[Bug 764170] Re: DocTestMatches error when 'actual' is unicode
*** This bug is a duplicate of bug 672056 ***
https://bugs.launchpad.net/bugs/672056
** This bug has been marked a duplicate of bug 672056
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2217-2258: ordinal not in range(128)
--
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/764170
Title:
DocTestMatches error when 'actual' is unicode
Status in testtools:
Triaged
Bug description:
When TestCase.assertThat is invoked with a unicode string and a
DocTestMatches instance, the _with_nl() call made by the
DocTestMatches.match() method fails if the argument 'actual' is a
unicode string.
class MyTestCase(TestCase)
def myTest(self):
foo = u"foo\u2026"
self.assertThat(foo, DocTestMatches(foo))
Trackback:
File "/home/ian/projects/lp-sourcedeps/eggs/testtools-0.9.10-py2.6.egg/testtools/testcase.py", line 341, in assertThat
mismatch = matcher.match(matchee)
File "/home/ian/projects/lp-sourcedeps/eggs/testtools-0.9.10-py2.6.egg/testtools/matchers.py", line 175, in match
with_nl = self._with_nl(actual)
File "/home/ian/projects/lp-sourcedeps/eggs/testtools-0.9.10-py2.6.egg/testtools/matchers.py", line 169, in _with_nl
result = str(actual)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 3: ordinal not in range(128)
------------
To manage notifications about this bug go to:
https://bugs.launchpad.net/testtools/+bug/764170/+subscriptions
References