本文整理汇总了Python中aql.options.Options.optimization方法的典型用法代码示例。如果您正苦于以下问题:Python Options.optimization方法的具体用法?Python Options.optimization怎么用?Python Options.optimization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aql.options.Options
的用法示例。
在下文中一共展示了Options.optimization方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_options_conditions
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import optimization [as 别名]
def test_options_conditions(self):
options = Options()
opt_type1 = RangeOptionType(min_value=0, max_value=5)
options.warn_level = opt_type1
options.warning_level = options.warn_level
opt_type2 = EnumOptionType(values=('debug', 'release', 'final'))
options.optimization = opt_type2
options.opt = options.optimization
options.warning_level = 0
options.optimization = 'release'
options.If().optimization.eq('debug').warning_level += 1
self.assertEqual(options.warn_level, 0)
options.optimization = 'debug'
self.assertEqual(options.warn_level, 1)
options.optimization = 'release'
options.If().warning_level.ge(2).optimization = 'debug'
options.If().optimization.eq('release').warning_level += 2
self.assertEqual(options.optimization, 'debug')
示例2: test_options_external_conditions
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import optimization [as 别名]
def test_options_external_conditions(self):
options = Options()
options.warning_level = RangeOptionType(min_value=0, max_value=5)
options.optimization = EnumOptionType(values=('debug',
'release',
'final'))
options.warning_level = 0
options.optimization = 'release'
options.If(options.If().warning_level.eq(3)).optimization = 'debug'
self.assertEqual(options.optimization, 'release')
options.warning_level = 3
self.assertEqual(options.optimization, 'debug')
options.If(True).optimization = 'final'
self.assertEqual(options.optimization, 'final')
options.If(Condition(None, lambda options, context: True)).\
optimization = 'release'
self.assertEqual(options.optimization, 'release')
options.If(Condition(None,
lambda options, context, op: op == 2,
options.warning_level)).optimization = 'debug'
self.assertEqual(options.optimization, 'release')
options.warning_level = 2
self.assertEqual(options.optimization, 'debug')
class _Value (object):
def __init__(self, value):
self.value = value
def set(self, value):
self.value = value
def get(self):
return bool(self.value)
v = _Value(1)
options.If(v).warning_level = 0
self.assertEqual(options.warning_level, 0)
v.set(0)
options.clear_cache()
self.assertEqual(options.warning_level.get(), 2)
示例3: test_options_conditions2
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import optimization [as 别名]
def test_options_conditions2(self):
options = Options()
options.warning_level = RangeOptionType( min_value = 0, max_value = 5 )
options.optimization = EnumOptionType( values = ('debug', 'release', 'final') )
options.build_variants = ListOptionType( value_type = options.optimization.optionType() )
options.If().build_variants.has('release').warning_level = 5
self.assertEqual( options.warning_level, 0 )
options.build_variants += 'release'
self.assertEqual( options.warning_level, 5 )