[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r19962 - trunk/subversion/bindings/swig/python/tests

From: Max Bowsher <maxb1_at_ukf.net>
Date: 2006-06-06 19:33:17 CEST

David James wrote:
> On 6/6/06, maxb@tigris.org <maxb@tigris.org> wrote:
>> Remove Python-2.4-isms from the Python bindings testsuite -
>> use unittest.TestCase.assert_(), not unittest.TestCase.assertTrue().
>
> Hey Max,
>
> Thanks for fixing this! However, I'm not sure this is the right fix.
>
> Instead of replacing 'assertTrue' with 'assert_', could we just write
> a compatibility wrapper function called 'assertTrue', which delegates
> to either assert_ or assertEqual(x, true)? assertTrue is a much better
> name for the function than 'assert_'.

I think assert_ is a good, if odd, name - it's clearly expressing its
congruency with the eponymous keyword, whilst doing a minimal workaround
for the fact that assert is a keyword.

We could trivially make assertTrue available on earlier Python versions:

try:
  unittest.TestCase.assertTrue
except AttributeError:
  unittest.TestCase.assertTrue = unittest.TestCase.assert_

... but I'm not sure we should, when there is a fully compatible
equivalent, and assertTrue is actually _undocumented_ at present.

Max.

Received on Tue Jun 6 19:33:53 2006

This is an archived mail posted to the Subversion Dev mailing list.