On Sun, Dec 09, 2012 at 08:05:52AM -0000, [email protected] 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.