Examining JPython
By Kirby W. Angell, April 01, 1999
JPython is a freely available version of Python implemented in 100 percent pure Java. Since JPython is written in Java, it is easy to include the JPython packages in a Java application and use JPython as your application's scripting engine. JPython also makes an excellent tool for prototyping Java applets that are embedded in web browsers.
Apr99: Programmer's Toolchest
<b>(a)</b>
exec( "import %s" % script )
module = locals()[script]
# if this module supports our testing interface
if module.__dict__.has_key( "addTests" ):
module.addTests( ts )
<b>(b)</b>
def addTests( ts ):
ts.add( BigIntegerTest( "BigIntegerTest" ) )
Example 4: (a) Dynamically loading test modules; (b) example of an addTests method for the BigIntegerTest.py module.
Copyright © 1999, Dr. Dobb's Journal