本文整理汇总了Python中aql.options.Options.debug_on方法的典型用法代码示例。如果您正苦于以下问题:Python Options.debug_on方法的具体用法?Python Options.debug_on怎么用?Python Options.debug_on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aql.options.Options
的用法示例。
在下文中一共展示了Options.debug_on方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_options_update
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import debug_on [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)
示例2: test_options
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import debug_on [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)
示例3: test_options_dict
# 需要导入模块: from aql.options import Options [as 别名]
# 或者: from aql.options.Options import debug_on [as 别名]
def test_options_dict(self):
options = Options()
options.cxx = PathOptionType()
options.debug_on = BoolOptionType()
options.defines = DictOptionType(key_type=str, value_type=str)
options.env = DictOptionType(key_type=UpperCaseString)
options.env['PATH'] = ListOptionType(
value_type=FilePath, separators=os.pathsep)
options.env['PATH'] = []
options.env['Include'] = list
options.env['HOME'] = FilePath()
options.env['Path'] = '/work/bin'
options.env['Include'] = '/work/bin'
self.assertEqual(options.env['path'].get(), '/work/bin')
self.assertEqual(options.env['Include'].get(), '/work/bin')
options.env['Path'] = options.env['Path'] + ['/usr/bin']
options.env['path'] += ['/usr/local/bin', '/home/user/bin']
options.env['Home'] = '/home/user'
options.env['path'] += options.env['Home']
options.env['path'] += options.cxx
options.cxx = '/mingw/bin/g++'
options.If().debug_on.eq(False).defines['DEBUG'] = 'FALSE'
options.If().debug_on.eq(True).defines['DEBUG'] = 'TRUE'
options.defines['OPTS'] = ''
options.If().defines['DEBUG'].eq(
'TRUE').defines['OPTS'] += options.defines['DEBUG']
path = list(map(FilePath, ['/work/bin', '/usr/bin', '/usr/local/bin',
'/home/user/bin', '/home/user',
'/mingw/bin/g++']))
value = options.env
self.assertEqual(value['path'].get(), path)
self.assertEqual(options.defines['OPTS'], '')
options.debug_on = True
self.assertEqual(options.defines['OPTS'], 'TRUE')