[英]How to exclude a method in Python?
我在 class 中有一個 Python 方法,如下所示。
method_A(self):
self.method1(self)
self.method2(self)
self.method3(self)
我需要在另一個 Python class 中調用整個 methodA methodA()
,方法是只從 methodA() 中排除self.method3(self)
methodA()
。
你能幫我實現它嗎? 我不想復制代碼只是為了排除一種方法。
試試這個我的朋友:
getattr(method_A,)
您可以使用 unittest 模塊中的 @SkipTest 注釋來排除特定方法的運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.