def test_getting_info_on_jython(self): dbg('\n\n--------------------------- java') assert not ismethod(java)[0] assert not isclass(java) assert _pydev_jy_imports_tipper.ismodule(java) dbg('\n\n--------------------------- java.lang') assert not ismethod(java.lang)[0] assert not isclass(java.lang) assert _pydev_jy_imports_tipper.ismodule(java.lang) dbg('\n\n--------------------------- Method') assert not ismethod(Method)[0] assert isclass(Method) dbg('\n\n--------------------------- System') assert not ismethod(System)[0] assert isclass(System) dbg('\n\n--------------------------- String') assert not ismethod(System)[0] assert isclass(String) assert len(dir_obj(String)) > 10 dbg('\n\n--------------------------- arraycopy') isMet = ismethod(arraycopy) assert isMet[0] assert isMet[1][0].basic_as_str() == "function:arraycopy args=['java.lang.Object', 'int', 'java.lang.Object', 'int', 'int'], varargs=None, kwargs=None, docs:None" assert not isclass(arraycopy) dbg('\n\n--------------------------- out') isMet = ismethod(out) assert not isMet[0] assert not isclass(out) dbg('\n\n--------------------------- out.println') isMet = ismethod(out.println) #@UndefinedVariable assert isMet[0] assert len(isMet[1]) == 10 self.assertEqual(isMet[1][0].basic_as_str(), "function:println args=[], varargs=None, kwargs=None, docs:None") assert isMet[1][1].basic_as_str() == "function:println args=['long'], varargs=None, kwargs=None, docs:None" assert not isclass(out.println) #@UndefinedVariable dbg('\n\n--------------------------- str') isMet = ismethod(str) #the code below should work, but is failing on jython 22a1 #assert isMet[0] #assert isMet[1][0].basic_as_str() == "function:str args=['org.python.core.PyObject'], varargs=None, kwargs=None, docs:None" assert not isclass(str) def met1(): a = 3 return a dbg('\n\n--------------------------- met1') isMet = ismethod(met1) assert isMet[0] assert isMet[1][0].basic_as_str() == "function:met1 args=[], varargs=None, kwargs=None, docs:None" assert not isclass(met1) def met2(arg1, arg2, *vararg, **kwarg): '''docmet2''' a = 1 return a dbg('\n\n--------------------------- met2') isMet = ismethod(met2) assert isMet[0] assert isMet[1][0].basic_as_str() == "function:met2 args=['arg1', 'arg2'], varargs=vararg, kwargs=kwarg, docs:docmet2" assert not isclass(met2)
def test_getting_info_on_jython(self): dbg('\n\n--------------------------- java') assert not ismethod(java)[0] assert not isclass(java) assert _pydev_jy_imports_tipper.ismodule(java) dbg('\n\n--------------------------- java.lang') assert not ismethod(java.lang)[0] assert not isclass(java.lang) assert _pydev_jy_imports_tipper.ismodule(java.lang) dbg('\n\n--------------------------- Method') assert not ismethod(Method)[0] assert isclass(Method) dbg('\n\n--------------------------- System') assert not ismethod(System)[0] assert isclass(System) dbg('\n\n--------------------------- String') assert not ismethod(System)[0] assert isclass(String) assert len(dir_obj(String)) > 10 dbg('\n\n--------------------------- arraycopy') isMet = ismethod(arraycopy) assert isMet[0] assert isMet[1][0].basic_as_str( ) == "function:arraycopy args=['java.lang.Object', 'int', 'java.lang.Object', 'int', 'int'], varargs=None, kwargs=None, docs:None" assert not isclass(arraycopy) dbg('\n\n--------------------------- out') isMet = ismethod(out) assert not isMet[0] assert not isclass(out) dbg('\n\n--------------------------- out.println') isMet = ismethod(out.println) #@UndefinedVariable assert isMet[0] assert len(isMet[1]) == 10 self.assertEqual( isMet[1][0].basic_as_str(), "function:println args=[], varargs=None, kwargs=None, docs:None") assert isMet[1][1].basic_as_str( ) == "function:println args=['long'], varargs=None, kwargs=None, docs:None" assert not isclass(out.println) #@UndefinedVariable dbg('\n\n--------------------------- str') isMet = ismethod(str) #the code below should work, but is failing on jython 22a1 #assert isMet[0] #assert isMet[1][0].basic_as_str() == "function:str args=['org.python.core.PyObject'], varargs=None, kwargs=None, docs:None" assert not isclass(str) def met1(): a = 3 return a dbg('\n\n--------------------------- met1') isMet = ismethod(met1) assert isMet[0] assert isMet[1][0].basic_as_str( ) == "function:met1 args=[], varargs=None, kwargs=None, docs:None" assert not isclass(met1) def met2(arg1, arg2, *vararg, **kwarg): '''docmet2''' a = 1 return a dbg('\n\n--------------------------- met2') isMet = ismethod(met2) assert isMet[0] assert isMet[1][0].basic_as_str( ) == "function:met2 args=['arg1', 'arg2'], varargs=vararg, kwargs=kwarg, docs:docmet2" assert not isclass(met2)