你好,我有个问题。 我有一个有5种方法的班级。我需要按顺序开始所有方法,但是如果第一个函数中的'if'给出了一个不好的结果,我必须转到最后一个方法(不做其余的)。怎么做
class Class(unittest.TestCase):
def test1(self):
if x!=0:
return elem
else:
print("Error")
#GoTo Last Function
def test2(self): print('1')
def test3(self): print('12')
def test4(self): print('123')
def test5(self): print('1234')
当然,函数体是唯一的例子。 我怎么做这个?谢谢你
目前没有回答
相关问题 更多 >
编程相关推荐