Python - Testing an abstract base class

前端 未结 6 1347
醉话见心
醉话见心 2020-12-04 16:27

I am looking for ways / best practices on testing methods defined in an abstract base class. One thing I can think of directly is performing the test on all concrete subclas

6条回答
  •  不知归路
    2020-12-04 17:26

    No, it's not. The very purpose of abc is to create classes that cannot be instantiated unless all abstract attributes are overridden with concrete implementations. Hence you need to derive from the abstract base class and override all abstract methods and properties.

提交回复
热议问题