[TIP] About assertMultilineEqual

Alfredo Deza alfredodeza at gmail.com
Tue Aug 17 07:33:56 PDT 2010


On Tue, Aug 17, 2010 at 9:55 AM, Michael Foord <fuzzyman at voidspace.org.uk>wrote:

>  On 17/08/2010 16:53, Alfredo Deza wrote:
>
>
>
> On Tue, Aug 17, 2010 at 5:43 AM, Michael Foord <fuzzyman at voidspace.org.uk>wrote:
>
>>  On 16/08/2010 02:21, Ned Batchelder wrote:
>>
>> I had to bridge this gap for coverage.py, and ended up doing it for a few
>> methods, see
>> http://bitbucket.org/ned/coveragepy/src/tip/test/backunittest.py
>>
>> But this method bothers me: the Multiline aspect has nothing to do with
>> the comparison, only with the reporting of failed assertions.  Better would
>> be to have assertEqual be smart enough to recognize that the arguments are
>> multiline strings, and just do the right thing with them.
>>
>>
>>  If you use unittest2 then you get assertMultilineEqual and smarter
>> assertEqual behaviour.
>>
>>  If unittest2 is meant for Python versions older than 2.7, how do you go
> around specifying that in a package? I usually have a:
>
>  tests_require = ['nose', 'webtest']
>
>  Or similar packages (e.g. pytest)
>
>
> unittest2 works fine with Python 2.7 (and will soon have features that are
> in unittest in python 3.2 but not in 2.7).
>
> ahh got it... so regardless of doing " install_requires = ['unittes2'] " in
Python2.7 and later, it will still work... I thought unittest2 was
*only* for extending compatibility to older versions of Python.

Thanks for the response!



> Michael Foord
>
>
>
>
>> Michael
>>
>>
>> --Ned.
>>
>> On 8/15/2010 8:42 PM, Alfredo Deza wrote:
>>
>> Hi,
>>
>>  Is there anything like assertMultilineEqual<http://docs.python.org/library/unittest.html#unittest.TestCase.assertMultiLineEqual>for older versions of Python (e.g. not 2.7)?
>>
>>  I think nose and pytest may have already solved that, but is there an
>> easy way that doesn't require added dependencies?
>>
>>  Thanks!
>>
>>
>> _______________________________________________
>> testing-in-python mailing listtesting-in-python at lists.idyll.orghttp://lists.idyll.org/listinfo/testing-in-python
>>
>>
>> _______________________________________________
>> testing-in-python mailing listtesting-in-python at lists.idyll.orghttp://lists.idyll.org/listinfo/testing-in-python
>>
>>
>>
>>  -- http://www.ironpythoninaction.com/
>>
>>
>
>
> -- http://www.ironpythoninaction.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20100817/559195f4/attachment-0001.htm>


More information about the testing-in-python mailing list