Consider this example:
class A:
def do_stuff(self):
# ...
some_var = self.helper_method()
# ...
def helper_method(self):
# This method must be implemented by subclass
raise NotImplementedError()
class B(A):
def helper_method(self):
# implementation for class B
class C(A):
def helper_method(self):
# implementation for class C
My task is to write unit tests for A, B and C classes (especially for do_stuff).
But how can I test A class if I cannot use some of it methods directly? Should I just test only B and C classes (which have implementation for helper_method) or maybe there is common way for testing abstract classes in Python?
Aucun commentaire:
Enregistrer un commentaire