* subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
[svn.git] / subversion / bindings / swig / python / tests / core.py
blob620bead0b34b1370ea64f7c9b61ea92183879958
1 import unittest, os
3 import svn.core
5 class SubversionCoreTestCase(unittest.TestCase):
6 """Test cases for the basic SWIG Subversion core"""
8 def test_SubversionException(self):
9 self.assertEqual(svn.core.SubversionException().args, ())
10 self.assertEqual(svn.core.SubversionException('error message').args,
11 ('error message',))
12 self.assertEqual(svn.core.SubversionException('error message', 1).args,
13 ('error message', 1))
14 self.assertEqual(svn.core.SubversionException('error message', 1).apr_err,
16 self.assertEqual(svn.core.SubversionException('error message', 1).message,
17 'error message')
19 def test_mime_type_is_binary(self):
20 self.assertEqual(0, svn.core.svn_mime_type_is_binary("text/plain"))
21 self.assertEqual(1, svn.core.svn_mime_type_is_binary("image/png"))
23 def test_mime_type_validate(self):
24 self.assertRaises(svn.core.SubversionException,
25 svn.core.svn_mime_type_validate, "this\nis\ninvalid\n")
26 svn.core.svn_mime_type_validate("unknown/but-valid; charset=utf8")
28 def suite():
29 return unittest.makeSuite(SubversionCoreTestCase, 'test')
31 if __name__ == '__main__':
32 runner = unittest.TextTestRunner()
33 runner.run(suite())