File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1- from scyjava import numeric_bounds , to_java
1+ from scyjava import jclass , jimport , numeric_bounds , to_java
2+ from scyjava .config import Mode , mode
23
34
45class TestTypes (object ):
@@ -30,3 +31,22 @@ def test_numeric_bounds(self):
3031 type (v_double )
3132 )
3233 assert (None , None ) == numeric_bounds (type (v_bigdec ))
34+
35+ def test_jclass (self ):
36+ if mode == Mode .JEP :
37+ # JEP does not support the jclass function.
38+ return
39+
40+ # A. Name of a class to look up -- e.g. "java.lang.String" -> String.class
41+ a_cls = jclass ("java.lang.String" )
42+ assert a_cls .getName () == "java.lang.String"
43+
44+ # B. A static-style class reference -- String -> String.class
45+ String = jimport ("java.lang.String" )
46+ b_cls = jclass (String )
47+ assert b_cls .getName () == "java.lang.String"
48+
49+ # C. A Java object -- String("hello") -> "hello".getClass()
50+ v_str = to_java ("gubernatorial" )
51+ c_cls = jclass (v_str )
52+ assert c_cls .getName () == "java.lang.String"
You can’t perform that action at this time.
0 commit comments