You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <da...@apache.org> on 2012/12/10 10:47:57 UTC

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

On Sun, Dec 09, 2012 at 08:05:52AM -0000, breser@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.