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

Re: svn commit: r1418830 - in /subversion/trunk/subversion/bindings/swig: core.i python/tests/checksum.py python/tests/run_all.py

From: Daniel Shahaf <danielsh_at_apache.org>
Date: Mon, 10 Dec 2012 09:47:57 +0000

On Sun, Dec 09, 2012 at 08:05:52AM -0000, breser_at_apache.org wrote:
> +class ChecksumTestCases(unittest.TestCase):
> + def test_checksum(self):
> + # Checking primarily the return type for the svn_checksum_create
> + # function
> + val = svn.core.svn_checksum_create(svn.core.svn_checksum_md5)
> + check_val = svn.core.svn_checksum_to_cstring_display(val)
> +
> + # The svn_checksum_to_cstring_display should return a str type object
> + # from the check_val object passed to it
> + if(type(check_val) == str):
> + # The intialized value created from a checksum should be 0

Typo in comment.

> + if(int(check_val) != 0):

It would be better to write:

    if check_val == '0'*32

(except that the test shouldn't hardcode "32")

This will catch a digest of the wrong length, and will avoid doing type
equality checking (inheritance checking is preferred).

> + self.assertRaises(AssertionError)

This line does not cause the test to fail. It returns a context manager ---
the language construct implementing the 'with' statement.

> + else:
> + self.assertRaises(TypeError, test_checksum)

Infinite recursion.
Received on 2012-12-10 10:48:05 CET

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