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


Python Options.warn_level方法代码示例

本文整理汇总了Python中aql.options.Options.warn_level方法的典型用法代码示例。如果您正苦于以下问题:Python Options.warn_level方法的具体用法?Python Options.warn_level怎么用?Python Options.warn_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aql.options.Options的用法示例。


在下文中一共展示了Options.warn_level方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_options_errors

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options_errors(self):
        options = Options()
        options2 = Options()

        options.opt = RangeOptionType(min_value=1, max_value=100)
        options.warn_level = RangeOptionType(min_value=0, max_value=5)

        options.opt = RangeOptionType(min_value=1, max_value=100)
        options2.opt2 = options.opt
        self.assertEqual(options.opt.get(), options2.opt2.get())
        options.opt = 50
        self.assertEqual(options.opt.get(), options2.opt2.get())
        options.opt = 20
        self.assertEqual(options.opt.get(), options2.opt2.get())
        options2.opt2 = 48
        self.assertNotEqual(options.opt.get(), options2.opt2.get())
        self.assertEqual(options.opt.get(), 20)
        self.assertEqual(options2.opt2.get(), 48)

        self.assertRaises(AttributeError, options.__getattr__, 'debug_on')

        options.opt = options.warn_level
        options.warn_level = 2
        self.assertEqual(options.opt, options.warn_level)
        self.assertEqual(options.opt, 2)
        self.assertIn('opt', options)
        self.assertNotIn('debug_on', options)
        self.assertRaises(ErrorOptionsNoIteration, iter, options)
开发者ID:lu-zero,项目名称:aqualid,代码行数:30,代码来源:aql_test_options.py

示例2: test_options_2

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options_2(self):
        options = Options()
        options2 = Options()

        options.warn_level = RangeOptionType(min_value=0, max_value=5)
        options2.warn_level = RangeOptionType(min_value=0, max_value=5)

        options.warn_level = 1
        options2.warn_level = 1

        self.assertEqual(options.warn_level, options2.warn_level)

        options.warn_level.set(2)
        self.assertEqual(options.warn_level, 2)
        self.assertNotEqual(options.warn_level, 1)
        self.assertLess(options.warn_level, 3)
        self.assertLessEqual(options.warn_level, 3)
        self.assertLessEqual(options.warn_level, 2)
        self.assertGreater(options.warn_level, 1)
        self.assertGreaterEqual(options.warn_level, 1)
        self.assertGreaterEqual(options.warn_level, 2)

        options.warn_levels = ListOptionType(
            value_type=options.warn_level.option_type())

        options.warn_levels += [1, 2, 3]

        self.assertIn(1, options.warn_levels)
        self.assertNotIn(5, options.warn_levels)
开发者ID:lu-zero,项目名称:aqualid,代码行数:31,代码来源:aql_test_options.py

示例3: test_options_update

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options_update(self):
        options = Options()

        options.opt = RangeOptionType(min_value=1, max_value=100)
        options.warn_level = RangeOptionType(min_value=0, max_value=5)

        args = {'opt': 5, 'warn_level': 3, 'debug_on': True}
        options.update(args)
        self.assertEqual(options.opt, args['opt'])
        self.assertEqual(options.warn_level, args['warn_level'])
        self.assertIn('debug_on', options)

        options.update({})
        options.update(options)
        self.assertRaises(ErrorOptionsMergeNonOptions, options.merge, args)

        options2 = Options()
        options2.debug_on = BoolOptionType()
        options2.debug_on = False
        options2.bv = ListOptionType(value_type=str)
        options2.bv += 'debug,release,final'
        options2.build_variant = options2.bv
        self.assertTrue(options.debug_on.option_value.option_type.is_auto)
        options.merge(options2)
        self.assertEqual(options.debug_on.get(), options2.debug_on.get())
        self.assertEqual(options.bv, options2.bv)
        self.assertEqual(options.bv, options2.build_variant)
        self.assertEqual(options2.bv, options2.build_variant)
        self.assertIs(
            options.bv.option_value, options.build_variant.option_value)

        options.merge(options2)
        self.assertEqual(options.debug_on, options2.debug_on)
        self.assertEqual(options2.bv, options2.build_variant)
开发者ID:lu-zero,项目名称:aqualid,代码行数:36,代码来源:aql_test_options.py

示例4: test_options_conditions

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [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

示例5: test_options_conditions4

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options_conditions4(self):
        options = Options()

        options.opt = RangeOptionType(min_value=1, max_value=100)
        options.warn_level = RangeOptionType(min_value=0, max_value=5)

        options.opt = 1
        options.If().warn_level.eq(3).opt += 10
        options.If().warn_level.ge(3).opt += 10

        options.warn_level = 3

        options.If().opt.one_of([1, 11, 21, 31]).opt -= 1
        options.If().opt.one_of([1, 11, 21, 31]).opt -= 1

        self.assertEqual(options.opt, 20)

        options.If().warn_level.ne(3).opt -= 1
        self.assertEqual(options.opt, 20)
        options.If().warn_level.ne(2).opt += 1
        self.assertEqual(options.opt, 21)

        options.If().warn_level.gt(3).opt += 1
        self.assertEqual(options.opt, 21)
        options.If().warn_level.gt(2).opt += 4
        self.assertEqual(options.opt, 25)

        options.If().warn_level.lt(3).opt += 1
        self.assertEqual(options.opt, 25)
        options.If().warn_level.lt(4).opt += 5
        self.assertEqual(options.opt, 30)

        options.If().warn_level.le(2).opt += 1
        self.assertEqual(options.opt, 30)
        options.If().warn_level.le(4).opt += 5
        self.assertEqual(options.opt, 35)

        tc = options.If().warn_level.le(4)
        tc.opt += 5
        self.assertEqual(options.opt, 40)
        tc.opt += 5
        self.assertEqual(options.opt, 45)

        to = tc.opt
        to += 5

        self.assertEqual(options.opt, 50)
开发者ID:lu-zero,项目名称:aqualid,代码行数:49,代码来源:aql_test_options.py

示例6: test_options

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options(self):
        options = Options()

        opt_type1 = RangeOptionType(min_value=0, max_value=5)

        options.warn_level = opt_type1
        options.warning_level = options.warn_level

        self.assertEqual(options.warn_level, options.warning_level)

        options.warning_level = 1

        self.assertEqual(options.warn_level, options.warning_level)

        options.warning_level += 1

        self.assertEqual(options.warn_level, 2)

        options.warning_level -= 2

        self.assertEqual(options.warn_level, 0)

        opt_type2 = BoolOptionType()
        options.debug_on = opt_type2
        options.debug_on = True
        self.assertEqual(options.debug_on, 'true')

        over_opts = options.override()
        self.assertEqual(over_opts.debug_on, 'true')
        options.debug_on = False
        self.assertEqual(over_opts.debug_on, 'false')
        options.debug_on = True
        self.assertEqual(over_opts.debug_on, 'true')

        over_opts.debug_on = False

        self.assertEqual(options.debug_on, 'true')
        self.assertEqual(over_opts.debug_on, 'false')
        self.assertEqual(over_opts.warn_level, 0)

        options.warning_level = 3
        self.assertEqual(over_opts.warn_level, 3)
        self.assertEqual(over_opts.warning_level, 3)
        over_opts.warn_level.set(1)
        self.assertEqual(options.warning_level, 3)
        self.assertEqual(options.warn_level, 3)
        self.assertEqual(over_opts.warning_level, 1)
        self.assertEqual(over_opts.warn_level, 1)

        over_opts = over_opts.copy()
        options.warning_level = 2
        self.assertEqual(options.warn_level, 2)
        self.assertEqual(over_opts.warn_level, 1)
        self.assertEqual(over_opts.warning_level, 1)

        over_opts.warn_level = 4
        self.assertEqual(over_opts.warn_level, 4)
        self.assertEqual(over_opts.warning_level, 4)
开发者ID:lu-zero,项目名称:aqualid,代码行数:60,代码来源:aql_test_options.py

示例7: test_options_refs

# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import warn_level [as 别名]
    def test_options_refs(self):
        options = Options()

        options.opt = RangeOptionType(min_value=1, max_value=100)
        options.warn_level = RangeOptionType(min_value=0, max_value=5)

        options.warn_level = op_iadd(options.opt)
        self.assertEqual(options.warn_level, 1)

        options.If().warn_level.eq(options.opt).warn_level += 1
        self.assertEqual(options.warn_level, 2)

        options.opt = 2

        self.assertEqual(options.warn_level, 3)

        options2 = Options()
        options2.opt1 = RangeOptionType(min_value=1, max_value=100)
        options2.opt2 = RangeOptionType(min_value=1, max_value=100)

        options.warn_level = options2.opt1

        self.assertEqual(options.warn_level.get(), options2.opt1.get())
        options2.opt1 = 4
        self.assertEqual(options.warn_level.get(), options2.opt1.get())

        self.assertRaises(
            ErrorOptionsCyclicallyDependent, options2.opt2.set, options.opt)

        options.warn_level.set(options.opt)
        self.assertEqual(options.warn_level, 2)

        options.test = 1
        self.assertEqual(options.test.get(), 1)

        options.opt += options.opt

        self.assertEqual(options.opt, 4)
开发者ID:lu-zero,项目名称:aqualid,代码行数:40,代码来源:aql_test_options.py


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