Lichen

tests/attr_providers.py

355:56863815fe7b
2016-12-09 Paul Boddie Removed the help function and superfluous object base class declarations.
     1 class C:     2     def __init__(self):     3         self.a = 1     4         self.c = 3     5      6     b = 2     7      8 class D:     9     def __init__(self):    10         self.a = 3    11         self.b = 4    12     13 class E:    14     a = 5    15     b = 6    16     17 def f(x):    18     return x.a, x.b    19     20 def g(x):    21     22     # Should only permit D instance and E.    23     24     x.a = 7    25     x.b = 8    26     return f(x)    27     28 def h(x):    29     x.c    30     x.a = 4    31     x.b    32     return f(x)    33     34 c = C()    35 d = D()    36 e = E()    37     38 print f(c)          # (1, 2)    39 print f(d)          # (3, 4)    40 print f(e)          # (5, 6)    41 print f(E)          # (5, 6)    42     43 try:    44     print g(c)      # should fail with an error caused by a test    45 except TypeError:    46     print "g(c): c is not a suitable argument."    47     48 print g(d)          # (7, 8)    49     50 try:    51     print g(e)      # should fail with an error caused by a test    52 except TypeError:    53     print "g(e): e is not a suitable argument."    54     55 print g(E)          # (7, 8)    56     57 print h(c)          # (4, 2)