testtools.tests.test_content.TestBytesContent.test_bytes fails on Python 3

Reported by Martin Packman on 2010-11-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Critical
Martin Packman

Bug Description

A new test added in r128 seems to have exposed an existing Python 3 issue, and fails:

======================================================================
ERROR: testtools.tests.test_content.TestBytesContent.test_bytes
----------------------------------------------------------------------
Text attachment: traceback
------------
Traceback (most recent call last):
  File "testtools\runtest.py", line 143, in _run_user
    return fn(*args)
  File "testtools\testcase.py", line 539, in _run_test_method
    return self._get_test_method()()
  File "testtools\tests\test_content.py", line 82, in test_bytes
    self.assertEqual(expected, text_content(data))
  File "testtools\testcase.py", line 309, in assertEqual
    self.assertThat(observed, matcher)
  File "testtools\testcase.py", line 373, in assertThat
    mismatch = matcher.match(matchee)
  File "testtools\matchers.py", line 192, in match
    if self.comparator(other, self.expected):
  File "testtools\content.py", line 34, in __eq__
    ''.join(self.iter_bytes()) == ''.join(other.iter_bytes()))
TypeError: sequence item 0: expected str instance, bytes found
------------

Can't be using str.join for bytes on Pythons where str is a unicode type.

Martin Packman (gz) on 2010-11-16
Changed in testtools:
assignee: nobody → Martin [gz] (gz)
status: New → In Progress
Jonathan Lange (jml) on 2010-11-27
Changed in testtools:
status: In Progress → Fix Committed
importance: Undecided → High
milestone: none → next
Changed in testtools:
importance: High → Critical
Changed in testtools:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers