micropython

tests/attributes2.py

218:b8550c04e807
2009-05-18 Paul Boddie Fixed FillDefaults temporarily, but a proper get_operand method is required for the instruction. Enhanced test outputs and comments.
     1 #!/usr/bin/env python     2      3 def e(x): pass     4      5 class C:     6     e = e     7      8     def test(self):     9         self.e()    10     11 class D:    12     e = C.e    13     14     def test(self):    15         self.e(1) # TypeError: unbound C.e needs C instance, not int    16     17 class E(C):    18     # e = C.e (via inheritance)    19     20     def test(self):    21         self.e()    22     23 c = C()    24 d = D()    25 e = E()    26     27 p = c.e # bound C.e    28 q = d.e # unbound C.e    29 r = e.e # bound E.e    30     31 # vim: tabstop=4 expandtab shiftwidth=4