You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2014/12/17 14:43:03 UTC

RE: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig: include/svn_types.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py python/tests/repository.py svn_repos.i


> -----Original Message-----
> From: stilor@apache.org [mailto:stilor@apache.org]
> Sent: dinsdag 2 december 2014 08:54
> To: commits@subversion.apache.org
> Subject: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig:
> include/svn_types.swg python/libsvn_swig_py/swigutil_py.c
> python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py
> python/tests/repository.py svn_repos.i
> 
> Author: stilor
> Date: Tue Dec  2 07:53:53 2014
> New Revision: 1642813

This patch introduces a dependency on assertListEqual() - new in Python 2.7- in the test suite, which seems to fail on at least one of our buildbots.

Is it possible to rewrite this test to keep compatibility with older python versions?

Thanks,

	Bert 



Re: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig: include/svn_types.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py python/tests/repository.py svn_repos.i

Posted by Julian Foad <ju...@btopenworld.com>.
I (Julian Foad) wrote:
> Branko Čibej wrote:
>>  On 18.12.2014 03:48, Alexey Neyman wrote:
>>>  Any objections to the attached fix?
>>> 
>>>>  + def _assertListEqual(self, l1, l2):
>>>>  + """Poor man's replacement for assertListEqual, available in Python
>>>>  2.7+"""
[...]
> So isn't it best just to call assertEqual() in the first place? It sounds 
> like that will delegate to assertListEqual() if available, and work in a simpler 
> older way otherwise.

The Python 2.6 docs show assertEqual comparing lists:
https://docs.python.org/2.6/library/unittest.html#basic-example

    self.assertEqual(self.seq, range(10))

- Julian


Re: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig: include/svn_types.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py python/tests/repository.py svn_repos.i

Posted by Julian Foad <ju...@btopenworld.com>.
Branko Čibej wrote:

> On 18.12.2014 03:48, Alexey Neyman wrote:
>> Any objections to the attached fix?
>> 
>>>  + def _assertListEqual(self, l1, l2):
>>>  + """Poor man's replacement for assertListEqual, available in Python
>>>  2.7+"""
>>>  + self.assertEqual(len(l1), len(l2))
>>>  + for i in range(0, len(l1)):
>>>  + self.assertEqual(l1[i], l2[i])
> 
> Perhaps just:
> 
>     map(self.assertEqual, l1, l2)
> 
> and I would prefer subclassing to instance method injection.

According to https://docs.python.org/2/library/unittest.html#type-specific-methods

"The assertEqual() method dispatches the equality check for objects of
the same type to different type-specific methods.  These methods are already
implemented for most of the built-in types..."

And under addTypeEqualityFunc it says:

"The list of type-specific methods automatically used by assertEqual() are summarized in the following table.  Note that it’s usually not necessary to invoke these methods directly."

So isn't it best just to call assertEqual() in the first place? It sounds like that will delegate to assertListEqual() if available, and work in a simpler older way otherwise.


- Julian


Re: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig: include/svn_types.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py python/tests/repository.py svn_repos.i

Posted by Branko Čibej <br...@wandisco.com>.
On 18.12.2014 03:48, Alexey Neyman wrote:
> Any objections to the attached fix?
>
>> + def _assertListEqual(self, l1, l2):
>> + """Poor man's replacement for assertListEqual, available in Python
>> 2.7+"""
>> + self.assertEqual(len(l1), len(l2))
>> + for i in range(0, len(l1)):
>> + self.assertEqual(l1[i], l2[i])


Perhaps just:

    map(self.assertEqual, l1, l2)


and I would prefer subclassing to instance method injection.

-- Brane

Re: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig: include/svn_types.swg python/libsvn_swig_py/swigutil_py.c python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py python/tests/repository.py svn_repos.i

Posted by Alexey Neyman <st...@att.net>.
Any objections to the attached fix?

Regards,
Alexey.

On 12/17/2014 05:43 AM, Bert Huijben wrote:
>
>> -----Original Message-----
>> From: stilor@apache.org [mailto:stilor@apache.org]
>> Sent: dinsdag 2 december 2014 08:54
>> To: commits@subversion.apache.org
>> Subject: svn commit: r1642813 - in /subversion/trunk/subversion/bindings/swig:
>> include/svn_types.swg python/libsvn_swig_py/swigutil_py.c
>> python/libsvn_swig_py/swigutil_py.h python/svn/core.py python/svn/repos.py
>> python/tests/repository.py svn_repos.i
>>
>> Author: stilor
>> Date: Tue Dec  2 07:53:53 2014
>> New Revision: 1642813
> This patch introduces a dependency on assertListEqual() - new in Python 2.7- in the test suite, which seems to fail on at least one of our buildbots.
>
> Is it possible to rewrite this test to keep compatibility with older python versions?
>
> Thanks,
>
> 	Bert
>
>
>