← Back to team overview

testtools-dev team mailing list archive

[Bug 675331] [NEW] testtools.tests.test_content.TestBytesContent.test_bytes fails on Python 3

 

Public bug reported:

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.

** Affects: testtools
     Importance: Undecided
         Status: New

-- 
testtools.tests.test_content.TestBytesContent.test_bytes fails on Python 3
https://bugs.launchpad.net/bugs/675331
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.

Status in testtools: New

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.





Follow ups

References