示例#1
0
        def testThrowChildExceptionFromCatchJExceptionParentClass(self) :
		try :
			self.jpype.exc.ExceptionTest.throwChildTestException()
			assert False
		except JException(self.jpype.exc.ParentTestException), ex :
                        pyexc = self.jpype.exc.ChildTestException.PYEXC
                        assert isinstance(ex, pyexc)
示例#2
0
	def testExceptionByJavaClass(self) :
		try :
			self.jpype.exc.ExceptionTest.throwRuntime()
			assert False
		except JException(java.lang.RuntimeException), ex :
			print "Caught the exception", ex.message(), "->", ex.javaClass()
			print ex.stacktrace()
示例#3
0
 def testExceptionByJavaClass(self):
     try:
         self.jpype.exc.ExceptionTest.throwRuntime()
         self.fail()  # pragma: no cover # <AK> added
     except JException(java.lang.RuntimeException) as ex:
         self.assertIs(ex.javaClass(), java.lang.RuntimeException)
         self.assertEqual('Foo', ex.message())
         trace = ex.stacktrace()
         self.assertTrue(trace.startswith('java.lang.RuntimeException: Foo'))
示例#4
0
 def testExceptionByJavaClass(self):
     try:
         self.jpype.exc.ExceptionTest.throwRuntime()
         self.fail()
     except JException(java.lang.RuntimeException) as ex:
         self.assertIs(type(ex), java.lang.RuntimeException)
         self.assertEqual('Foo', ex.message())
         trace = ex.stacktrace()
         self.assertTrue(str(trace).startswith(
             'java.lang.RuntimeException: Foo'))
示例#5
0
文件: test_exc.py 项目: JiadaoZ22/NLP
    def testExceptionByJavaClass(self):
        try:
            self.jpype.exc.ExceptionTest.throwRuntime()
            assert False

        except JException(java.lang.RuntimeException) as ex:
            print(("Caught the exception {0} -> {1}".format(
                ex.message(), ex.javaClass())))
            print(ex.stacktrace())

        except Exception as ex:
            print(ex)
            assert False
示例#6
0
 def testThrowChildExceptionFromCatchJExceptionParentClass(self):
     try:
         self.jpype.exc.ExceptionTest.throwChildTestException()
         self.fail()
     except JException(self.jpype.exc.ParentTestException) as ex:
         self.assertIsInstance(ex, self.jpype.exc.ChildTestException)
示例#7
0
 def testThrowChildExceptionFromCatchJExceptionParentClass(self):
     try:
         self.jpype.exc.ExceptionTest.throwChildTestException()
         self.fail()  # pragma: no cover # <AK> added
     except JException(self.jpype.exc.ParentTestException) as ex:
         self.assertIsInstance(ex, self.jpype.exc.ChildTestException.PYEXC)