社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
私信  •  关注

b0lle

b0lle 最近创建的主题
b0lle 最近回复了
3 年前
回复了 b0lle 创建的主题 » Python:用具体的实现细节测试抽象类

您可以简单地使用多重继承:

# test_animals.py
import unittest

from animals import Animal


class TestAnimal(unittest.TestCase, Animal):

    def description(self) -> str:
        return "Unittest"

    def test_zoo_str(self) -> None:
        assert self.zoo_str() == "UnittestGet more info at zoo.com!"