本文整理匯總了Python中tester.Tester.clean方法的典型用法代碼示例。如果您正苦於以下問題:Python Tester.clean方法的具體用法?Python Tester.clean怎麽用?Python Tester.clean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tester.Tester
的用法示例。
在下文中一共展示了Tester.clean方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from tester import Tester [as 別名]
# 或者: from tester.Tester import clean [as 別名]
def main(args):
with file('arena.json', 'rb') as json_f:
config = json.load(json_f)
svc_list = config['services']
cns_list = config['consumers']
sts_list = config['suites']
if len(args) < 2:
exit_errmsg(USAGE.format(progname=args[0],
services=usage_format(svc_list),
consumers=usage_format(cns_list),
suites=usage_format(sts_list)))
else:
tst = Tester()
if args[1] == 'test':
svc_name, cns_name = args[2:4]
tst.test_pair(resolve(svc_list, svc_name, 'service'),
resolve(cns_list, cns_name, 'consumer'))
elif args[1] == 'clean':
tst.clean(config[args[2] + 's'][args[3]])
elif args[1] == 'measure':
if len(args) < 3:
suites = sts_list.itervalues()
else:
suites = [resolve(sts_list, args[2], 'suite')]
if len(args) < 4:
repeats = config['measurement']['repeats']
else:
repeats = [int(args[3])]
if len(args) < 5:
runs = config['measurement']['runs']
else:
runs = int(args[4])
measure(suites, repeats, runs, svc_list, cns_list)
else:
exit_errmsg('Invalid command: "{0}"'.format(args[1]))
示例2: case
# 需要導入模塊: from tester import Tester [as 別名]
# 或者: from tester.Tester import clean [as 別名]
#!/usr/bin/env python2
from tester import Tester
def case (k):
import random
k=random.randint(1,k)
chance=random.random()
return str(k)+"\n"+"".join("j" if random.random()>chance else "p" for i in range(k))+"\n"
tester=Tester("bar")
tester.add_testcase(100, case, (20,), "small")
tester.add_testcase(100, case, (10**3,), "mid")
tester.add_testcase(100, case, (10**6,), "max")
tester.clean()
tester.generate_tests()
tester.generate_correct_answers()
tester.run_testing()
tester.make_package()