The get_calling_class
function must return the class that called the A.f
method:
class A:
def f(self): return get_calling_class()
class B(A):
def g(self): return self.f()
class C(B):
def h(self): return self.f()
c = C()
assert c.g() == B
assert c.h() == C
Aucun commentaire:
Enregistrer un commentaire