Example #1
0
except ValueError:
    pass

t2 = Test2(t.shape)
t2s = t2.shape
ts = t.shape
assert t2s == ts
t2.alwayspositive = 5
assert t2.alwayspositive == 5
try:
    t2.alwayspositive = 12
except ValueError:
    pass
assert t2.alwayspositive == 5
import pickle
s = pickle.dumps(t2)

t3 = Test3((4,5))
t3.shape = (4,3)
assert t3.shape == (4,3)
PropertiedClasses.show_properties(Test3)

t4 = Test4()
t4.a = 1
try:
    t4.aaa = 2
    raise RuntimeError, 'Test4 test failed.'
except AttributeError:
    pass
print "Test passed."