Log Message: Improve support for svn_checksum.h in SWIG bindings * subversion/bindings/swig/python/tests/checksum.py: Improved test_checksum
Modified: subversion/trunk/subversion/bindings/swig/python/tests/checksum.py On Tue, Dec 11, 2012 at 11:05 PM, Daniel Shahaf <danie...@elego.de> wrote: > Shivani Poddar wrote on Tue, Dec 11, 2012 at 22:54:58 +0530: > > I did use the assert functions on the same line but i did understand the > > earlier concerns cited that although they compiled they werent the exact > > Ben was not referring to unittest.assertRaises() but to other > unittest.assertFoo() functions. > -- Shivani Poddar, Bachelors in Computer Sciences and MS in Exact Humanities, Sophomore International Institute of Information Technology, Hyderabad
Index: subversion/bindings/swig/python/tests/checksum.py =================================================================== --- subversion/bindings/swig/python/tests/checksum.py (revision 1419694) +++ subversion/bindings/swig/python/tests/checksum.py (working copy) @@ -20,23 +20,18 @@ # import unittest, setup_path import svn.core - +LENGTH = svn.core.svn_checksum_size(svn.core.svn_checksum_create(svn.core.svn_checksum_md5)) 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) + + self.assertEqual(type(check_val),str,"Type of digest not string") + self.assertEqual(len(check_val)%LENGTH,0,"Length of digest does not match kind") + self.assertEqual(int(check_val),0,"Value of initialized digest is not 0") - # 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) - def suite(): return unittest.defaultTestLoader.loadTestsFromTestCase(ChecksumTestCases) if __name__ == '__main__': @@ -45,4 +40,3 @@ -