Beispiel #1
0
 def test_argument_passing(self):
     self.assertEqual(
         DemoExtension.concatFirstWithLastString.__doc__,
         "Concatenates first with last element. Returns empty string, if less than two args are available.",
     )
     self.assertEqual(DemoExtension.concatFirstWithLastString("begin_", "ignore", "ignore too", "end"), "begin_end")
     self.assertEqual(DemoExtension.argCountToString.__doc__, "Returns number of arguments as string.")
     self.assertEqual(DemoExtension.argCountToString("a", "b", "c", "d", "e", "f"), "(6)")
Beispiel #2
0
 def test_argument_passing(self):
     self.assertEqual(
         DemoExtension.concatFirstWithLastString.__doc__,
         "Concatenates first with last element. Returns empty string, if less than two args are available."
     )
     self.assertEqual(
         DemoExtension.concatFirstWithLastString("begin_", "ignore",
                                                 "ignore too", "end"),
         "begin_end")
     self.assertEqual(DemoExtension.argCountToString.__doc__,
                      "Returns number of arguments as string.")
     self.assertEqual(
         DemoExtension.argCountToString("a", "b", "c", "d", "e", "f"),
         "(6)")
Beispiel #3
0
#print "To prove that Jython is running, we make a java call:"
#from  java.lang import System
#print "System.currentTimeMillis: "+str(System.currentTimeMillis())


print ""
print "--------Hello World----------"
print DemoExtension.hello_world
print DemoExtension.hello_world.__doc__
DemoExtension.hello_world()

print ""
print "--------Argument passing----------"
print DemoExtension.concatFirstWithLastString.__doc__
print DemoExtension.concatFirstWithLastString("begin_", "ignore", "ignore too", "end")
print DemoExtension.argCountToString.__doc__
print DemoExtension.argCountToString("a", "b", "c", "d", "e", "f")

print ""
print "--------Argument passing with keywords----------"
DemoExtension.keywordTest("first", "second", right = "Hey", wrong = "nothing")
print "(in JyNI-case see bottom for native outputs)"

print ""
print "----------------Integer passing-----------------"
print DemoExtension.intSquare.__doc__
print DemoExtension.intSquare
print DemoExtension.intSquare.__class__
print DemoExtension.intSquare.__name__
print "Native square result of 16: "+str(DemoExtension.intSquare(16))
Beispiel #4
0
# nor ordinary CPython could run.

#print "To prove that Jython is running, we make a java call:"
#from  java.lang import System
#print "System.currentTimeMillis: "+str(System.currentTimeMillis())

print ""
print "--------Hello World----------"
print DemoExtension.hello_world
print DemoExtension.hello_world.__doc__
DemoExtension.hello_world()

print ""
print "--------Argument passing----------"
print DemoExtension.concatFirstWithLastString.__doc__
print DemoExtension.concatFirstWithLastString("begin_", "ignore", "ignore too",
                                              "end")
print DemoExtension.argCountToString.__doc__
print DemoExtension.argCountToString("a", "b", "c", "d", "e", "f")

print ""
print "--------Argument passing with keywords----------"
DemoExtension.keywordTest("first", "second", right="Hey", wrong="nothing")
print "(in JyNI-case see bottom for native outputs)"

print ""
print "----------------Integer passing-----------------"
print DemoExtension.intSquare.__doc__
print DemoExtension.intSquare
print DemoExtension.intSquare.__class__
print DemoExtension.intSquare.__name__
print "Native square result of 16: " + str(DemoExtension.intSquare(16))