You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/12/11 20:03:50 UTC
svn commit: r1420334 -
/subversion/trunk/subversion/bindings/swig/python/tests/checksum.py
Author: danielsh
Date: Tue Dec 11 19:03:49 2012
New Revision: 1420334
URL: http://svn.apache.org/viewvc?rev=1420334&view=rev
Log:
Followup to r1418830: improve the new test.
* subversion/bindings/swig/python/tests/checksum.py
(ChecksumTestCases.test_checksum):
Rewrite so that it will FAIL sometimes. Remove errorful uses
of assertRaises().
Patch by: Shivani Poddar <sh...@gmail.com>
danielsh
breser
Modified:
subversion/trunk/subversion/bindings/swig/python/tests/checksum.py
Modified: subversion/trunk/subversion/bindings/swig/python/tests/checksum.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/python/tests/checksum.py?rev=1420334&r1=1420333&r2=1420334&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/python/tests/checksum.py (original)
+++ subversion/trunk/subversion/bindings/swig/python/tests/checksum.py Tue Dec 11 19:03:49 2012
@@ -27,18 +27,20 @@ class ChecksumTestCases(unittest.TestCas
# 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
- if(int(check_val) != 0):
- self.assertRaises(AssertionError)
- else:
- self.assertRaises(TypeError, test_checksum)
+ expected_length = svn.core.svn_checksum_size(
+ svn.core.svn_checksum_create(
+ svn.core.svn_checksum_md5))
+
+ self.assertTrue(isinstance(check_val, str),
+ "Type of digest not string")
+ self.assertEqual(len(check_val), 2*expected_length,
+ "Length of digest does not match kind")
+ self.assertEqual(int(check_val), 0,
+ "Value of initialized digest is not 0")
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(ChecksumTestCases)
+
if __name__ == '__main__':
runner = unittest.TextTestRunner()
runner.run(suite())