1 #!/usr/bin/env python 2 3 """ 4 This test attempts to guard 'obj' in 'test_one' with only an instance check for 5 D instances. In the process, the unused methods should be discarded. 6 """ 7 8 class C: 9 def f(self): # unused 10 return 1 11 12 class D: 13 def f(self): 14 return 2 15 16 def __init__(self, g): 17 self.g = g 18 19 class E: 20 def f(self): # unused 21 return 4 22 23 def h(self): # unused 24 return 5 25 26 def test_one(obj): 27 # obj: f, g 28 obj.f() 29 return obj.g 30 31 c = C() 32 d = D(4) 33 e = E() 34 result1_4 = test_one(d) 35 36 # vim: tabstop=4 expandtab shiftwidth=4