问题描述
想象我们有一个对象(玩具示例):
bool actionRun = false;
bool keyPress = someCodeForKeyPress;
while(true) {
if(keyPress) {
if(!actionRun) {
action();
actionRun = true;
}
} else {
actionRun = false;
}
}
我们要测试该对象。测试的示例可能是:
class Person:
def __init__(self,name,age):
self.name = name
self.age = age
def print_name(self):
return self.name
def agex2(self):
return 2 * self.age
,但我们想与更多的人(“ Mike”,23岁)进行测试,而无需再次编写测试。我知道有一个称为参数化的模块,但是在测试对象或类时我不知道如何使用它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)