def testStaticJavaMethods(self): """ Instances of Java classes should not show static methods as completion choices. """ static_methods = jintrospect.getAutoCompleteList( "String", {"String": String}) self.assert_("valueOf" in static_methods, "'valueOf' missing from static method list") instance_methods = jintrospect.getAutoCompleteList( "s", {"s": String("Test")}) self.assert_("valueOf" not in instance_methods, "'valueOf' should not be in the instance method list")
def showPopup(self, event=None): """show code completion popup""" try: line = self.getText() list = jintrospect.getAutoCompleteList(line, self.locals, includeSingle=self.include_single_underscore_methods, includeDouble=self.include_double_underscore_methods) if len(list) > 0: self.popup.showMethodCompletionList(list, self.getDisplayPoint()) except Exception, e: pass
def showPopup(self, event=None): """show code completion popup""" try: line = self.getText() list = jintrospect.getAutoCompleteList(line, self.locals, includeSingle=self.include_single_underscore_methods, includeDouble=self.include_double_underscore_methods) if len(list) > 0: self.popup.showMethodCompletionList(list, self.getDisplayPoint()) except Exception, e: print >> sys.stderr, "Error getting completion list: ", e
def showPopup(self, event=None): line = self.getinput() # this is silly, I have to add the '.' and the other code removes it. line = line[:-1] # remove \n line = line + "." # print >> sys.stderr, "line:",line # TODO get this code into Popup # TODO handle errors gracefully try: list = jintrospect.getAutoCompleteList(line, self.locals) except Exception, e: # TODO handle this gracefully print >>sys.stderr, e return
def showPopup(self, event=None): line = self.getinput() # this is silly, I have to add the '.' and the other code removes it. line = line[:-1] # remove \n line = line + '.' #print >> sys.stderr, "line:",line # TODO get this code into Popup # TODO handle errors gracefully try: list = jintrospect.getAutoCompleteList(line, self.locals) except Exception, e: # TODO handle this gracefully print >> sys.stderr, e return
def testJavaAccessorAsProperty(self): instance_methods = jintrospect.getAutoCompleteList("s", {"s" : String("Test")}) self.assert_("class" in instance_methods, "'class' property should be in the instance method list")
def testStaticJavaMethods(self): """ Instances of Java classes should not show static methods as completion choices. """ static_methods = jintrospect.getAutoCompleteList("String", {"String" : String}) self.assert_("valueOf" in static_methods, "'valueOf' missing from static method list") instance_methods = jintrospect.getAutoCompleteList("s", {"s" : String("Test")}) self.assert_("valueOf" not in instance_methods, "'valueOf' should not be in the instance method list")
def testAutoCompleteString(self): f = "foo" list = jintrospect.getAutoCompleteList("f", locals()) self.assert_(len(list) > 0) self.assert_(list.index("startswith") > 0)
def testJavaAccessorAsProperty(self): instance_methods = jintrospect.getAutoCompleteList( "s", {"s": String("Test")}) self.assert_("class" in instance_methods, "'class' property should be in the instance method list")
def testStaticPropertyFromAncestorInterface(self): from javax.xml.transform.stream import StreamResult list = jintrospect.getAutoCompleteList("StreamResult", locals()) self.assert_(len(list) > 0) self.assert_(list.index("PI_ENABLE_OUTPUT_ESCAPING") > -1)
def testStaticCompletion(self): from java.util import Calendar list = jintrospect.getAutoCompleteList("Calendar", locals()) self.assert_(len(list) > 0) self.assert_(list.index("getInstance") > -1)
def testStaticAutoComplete(self): from java.util.logging import Level list = jintrospect.getAutoCompleteList("Level", locals()) self.assertEquals(10, len(list)) self.assert_(list.index("INFO") > -1)
def testStaticMethodFromAncestor(self): from javax.swing.border import EtchedBorder list = jintrospect.getAutoCompleteList("EtchedBorder", locals()) #print list self.assert_(len(list) > 0) self.assert_(list.index("getInteriorRectangle") > -1)
def testGetAutoCompleteList(self): s = String("Unit Test") list = jintrospect.getAutoCompleteList("s", locals()) self.assertNotEmpty(list) self.assertContains(list, "contains")
def testStaticPropertyFromAncestor(self): from javax.swing import JButton list = jintrospect.getAutoCompleteList("JButton", locals()) self.assert_(len(list) > 0) self.assert_(list.index("TEXT_CHANGED_PROPERTY") > -1)