1# test calling a subclass of a native class that supports calling 2 3# For this test we need a native class that can be subclassed (has make_new) 4# and is callable (has call). The only one available is machine.Signal, which 5# in turns needs PinBase. 6try: 7 try: 8 import umachine as machine 9 except ImportError: 10 import machine 11 machine.PinBase 12 machine.Signal 13except: 14 print("SKIP") 15 raise SystemExit 16 17class Pin(machine.PinBase): 18 #def __init__(self): 19 # self.v = 0 20 21 def value(self, v=None): 22 return 42 23 24class MySignal(machine.Signal): 25 pass 26 27s = MySignal(Pin()) 28 29# apply call to the subclass, which should call the native base 30print(s()) 31