假设您得到以下测试代码,其中test1
和方法在对象test2
上运行一些测试。grid
N = 10
grid = Grid(N)
def test1():
...
def test2():
...
何时添加测试以便N = 11
在新对象上运行相同的方法 test1 和 test2 的最佳方法是什么?当然可以简单地创建一个新文件,如下所示
N = 11
grid = Grid(N)
def test1():
...
def test2():
...
但这会导致大量代码重复。