testing-cabal / unittest-ext

Automatically exported from code.google.com/p/unittest-ext
2 stars 2 forks source link

msg argument to assert* method is concatenated before calling repr, unicode or str. #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call a failing assert* method
2. Pass as msg some value that is not concatenable with basestring

What is the expected output? What do you see instead?

I expect to see the standard message with my message inserted (through 
string interpolation for example.

I see
<pre>
ERROR: The view should set the appropriate context variables.
---------------------------------------------------------
-------------
Traceback (most recent call last):
  File "/Users/ryszard/SetJam/setjam/site-python/unittest2/case.py", line 
324, in run
    testMethod()
  File 
"/Users/ryszard/SetJam/setjam/setjam/subscriptions/tests/test_views.py", 
line 217, in test_context
    self.assertSameElements(r.context['seasons'], [1, 2], r.context['seasons'])
  File "/Users/ryszard/SetJam/setjam/site-python/unittest2/case.py", line 
848, in assertSameElements
    self.fail(self._formatMessage(msg, standardMsg))
  File "/Users/ryszard/SetJam/setjam/site-python/unittest2/case.py", line 
424, in _formatMessage
    return standardMsg + ' : ' + msg
TypeError: cannot concatenate 'str' and 'ValuesListQuerySet' objects
</pre>

Original issue reported on code.google.com by ryszard....@gmail.com on 6 Mar 2010 at 3:23

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. This is now fixed in the repository and will be in 
the
next release. Needs fixing in the Python version too!

Original comment by fuzzyman on 7 Mar 2010 at 1:27