Home > Enterprise >  How to exclude a method in Python?
How to exclude a method in Python?

Time:08-31

I have a Python method in a class like below.

method_A(self):
    self.method1(self)
    self.method2(self)
    self.method3(self)

I need to call the entire methodA() in another Python class by excluding only self.method3(self) from the methodA().

Could you please help me to achieve it? I don't want to duplicate the code just to exclude one method.

CodePudding user response:

Try this my friend:

getattr(method_A,)

CodePudding user response:

You can use the @SkipTest annotation from the unittest module to exclude a specific method from being run.

  • Related