def test_java_classpath(): import java try: java.add_to_classpath(1) except TypeError as e: assert "classpath argument 1 must be string, not int" in str(e) try: java.add_to_classpath('a', 1) except TypeError as e: assert "classpath argument 2 must be string, not int" in str(e)
def __setup__(*args): import os __dir__ = os.path.dirname(__file__) javafile = os.path.join(__dir__, "Image.java") with open(javafile, "w") as f: f.write(JAVA_CODE) os.system("javac " + javafile) import java java.add_to_classpath(__dir__) global Image Image = java.type("Image")