我正在写我的第一个py.test测试,我已经写了如下的测试
class Test_X_Values(object):
def test_value_1(self, fix_A):
A = fix_A['first']
B = fix_A['second']
# some statements here
#the following part is common for all
if ( A.X == True and B.Y == True):
#perform something. for example
print 'performing'
def test_value_2(self, fix_A):
#some statements
if ( A.X == True and B.Y == True):
#perform something. for example
print 'performing'
所以我决定写一个函数
def check(self, A, B):
if ( A.X == True and B.Y == True):
#perform something. for example
print 'performing'
除了在每个测试结束时写入check(A,B)之外,还有什么优雅的方法在每个测试结束时执行这个函数“check”吗
目前没有回答
相关问题 更多 >
编程相关推荐