1 #!/usr/bin/env python 2 3 """ 4 This test attempts to record the usage of 'C', 'D' or 'E' in the module code 5 since 'f' and 'g' might be used, but only 'f' is actually required. Although 6 only 'D' provides both attributes, classes 'C' and 'E' provide 'f'. 7 8 The local usage of 'g' in the 'local_usage' function is not currently 9 considered. 10 """ 11 12 class C: 13 def f(self): # unused but retained 14 return 1 15 16 class D: 17 def f(self): 18 return 2 19 20 def g(self): 21 return 3 22 23 class E: 24 def f(self): # unused but retained 25 return 4 26 27 def h(self): # unused 28 return 5 29 30 def local_usage(): 31 return obj.g() # would indicate D usage 32 33 c = C() 34 d = D() 35 e = E() 36 37 obj = c 38 obj = d 39 # obj: f, g; f 40 if obj.f(): 41 x = obj.g() 42 else: 43 x = 2 44 45 result1_3 = x 46 result2_3 = local_usage() 47 48 # vim: tabstop=4 expandtab shiftwidth=4