Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 测试一个接口的多个实现_Python_Unit Testing - Fatal编程技术网

Python 测试一个接口的多个实现

Python 测试一个接口的多个实现,python,unit-testing,Python,Unit Testing,假设我有一个定义如下的接口: class MyInterface(abc.ABCMeta): @abstractmethod def my_method(self, *params): pass 以及它的几个实现 class Implentation1(MyInterface): pass class Implentation2(MyInterface): pass 所有这些类都必须在同一类下进行测试。我想知道是否有任何方法可以指定您

假设我有一个定义如下的接口:

class MyInterface(abc.ABCMeta):

    @abstractmethod
    def my_method(self, *params):
         pass
以及它的几个实现

class Implentation1(MyInterface):
     pass

class Implentation2(MyInterface):
     pass

所有这些类都必须在同一类下进行测试。我想知道是否有任何方法可以指定您希望使用不同的类运行测试用例。我使用的是nosetest和unittest。

您可以
参数化测试,并向它们提供实现列表。