| 1 | # ***************************************************************************** |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | # See NOTICE file for details. |
| 16 | # |
| 17 | # ***************************************************************************** |
| 18 | import jpype |
| 19 | from jpype.types import * |
| 20 | from jpype import java |
| 21 | import common |
| 22 | |
| 23 | |
| 24 | class HtmlTestCase(common.JPypeTestCase): |
| 25 | |
| 26 | def setUp(self): |
| 27 | common.JPypeTestCase.setUp(self) |
| 28 | |
| 29 | def testEntities(self): |
| 30 | html = JClass("org.jpype.html.Html") |
| 31 | for k, v in html.ENTITIES.items(): |
| 32 | u = html.decode("&" + str(k) + ";") |
| 33 | self.assertIsInstance(u, JString) |
| 34 | self.assertEqual(len(u), 1) |
| 35 | self.assertEqual(ord(u[0][0]), v) |
| 36 | |
| 37 | def testClass(self): |
| 38 | JC = jpype.JClass("jpype.doc.Test") |
| 39 | jd = JC.__doc__ |
| 40 | self.assertIsInstance(jd, str) |
| 41 | # Disabled this test for now. Java needs a better API for accessing Java doc. |
| 42 | # It is hard to deal with random changes every version. |
| 43 | #self.assertRegex(jd, "random stuff") |
| 44 | |
| 45 | def testMethod(self): |
| 46 | JC = jpype.JClass("jpype.doc.Test") |
| 47 | jd = JC.methodOne.__doc__ |
| 48 | self.assertIsInstance(jd, str) |
| 49 | # Disabling this test for now. Something fails in Linux but I can't replicate it. |
| 50 | #self.assertRegex(jd, "something special") |