try: __import__("") raise TestFailed except ValueError: pass print_test('xrange implementation is broken for almost any complex case #29') assert list(xrange(10)[9:1:-1]) == [9, 8, 7, 6, 5, 4, 3, 2] print_test('Trying to assign to a method of a Java instance throws a NullPointerException #30') from java.awt import Button b = Button() try: b.setLabel = 4 raise TestFailed except TypeError: pass print_test('From 1.0.1 to 1.0.2', 1) print_test('A threading test', 2) from java.lang import Thread class TestThread(Thread): def run(self): for i in range(100): exec("x=2+2") print ' finished'
try: __import__("") raise TestFailed except ValueError: pass print 'xrange implementation is broken for almost any complex case #29' assert list(xrange(10)[9:1:-1]) == [9, 8, 7, 6, 5, 4, 3, 2] print 'Trying to assign to a method of a Java instance throws a NullPointerException #30' from java.awt import Button b = Button() try: b.setLabel = 4 raise TestFailed except TypeError: pass print 'From 1.0.1 to 1.0.2' print 'A threading test' from java.lang import Thread class TestThread(Thread): def run(self): for i in range(100): exec("x=2+2") print ' finished'
#!/usr/bin/env python # vim: set fileencoding=utf-8 from java.awt import Color from java.lang import StringBuffer from java.awt import Button print("\nButton") b = Button("label") print(b.getLabel()) print(b.label) b.setLabel("new label") print(b.getLabel()) print(b.label) b.label = "yet another label" print(b.getLabel()) print(b.label) print("\nb") b.background = Color.RED print(b.background) print("\nb2") b2 = Button(label="label", background=Color.GREEN) print(b2.background)