当前位置: 首页>>代码示例>>Python>>正文


Python Options.optimization方法代码示例

本文整理汇总了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')
开发者ID:lu-zero,项目名称:aqualid,代码行数:32,代码来源:aql_test_options.py

示例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)
开发者ID:JamesLinus,项目名称:aqualid,代码行数:54,代码来源:test_options.py

示例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 )
开发者ID:menify,项目名称:sandbox,代码行数:18,代码来源:aql_test_options.py


注:本文中的aql.options.Options.optimization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。