本文整理汇总了Python中spinnaker.validate_configuration.ValidateConfig.verify_true_false方法的典型用法代码示例。如果您正苦于以下问题:Python ValidateConfig.verify_true_false方法的具体用法?Python ValidateConfig.verify_true_false怎么用?Python ValidateConfig.verify_true_false使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spinnaker.validate_configuration.ValidateConfig
的用法示例。
在下文中一共展示了ValidateConfig.verify_true_false方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_true_false_good
# 需要导入模块: from spinnaker.validate_configuration import ValidateConfig [as 别名]
# 或者: from spinnaker.validate_configuration.ValidateConfig import verify_true_false [as 别名]
def test_true_false_good(self):
bindings = YamlBindings()
bindings.import_dict(
{'t': True, 'f':False, 'indirect':'${t}', 'default': '${x:true}'})
validator = ValidateConfig(
configurator=Configurator(bindings=bindings))
self.assertTrue(validator.verify_true_false('t'))
self.assertTrue(validator.verify_true_false('f'))
self.assertTrue(validator.verify_true_false('indirect'))
self.assertTrue(validator.verify_true_false('default'))
示例2: test_true_false_not_resolved
# 需要导入模块: from spinnaker.validate_configuration import ValidateConfig [as 别名]
# 或者: from spinnaker.validate_configuration.ValidateConfig import verify_true_false [as 别名]
def test_true_false_not_resolved(self):
bindings = YamlBindings()
bindings.import_dict({'indirect': '${t}'})
validator = ValidateConfig(
configurator=Configurator(bindings=bindings))
self.assertFalse(validator.verify_true_false('indirect'))
self.assertEqual('Missing "indirect".', validator.errors[0])
示例3: test_true_false_bad
# 需要导入模块: from spinnaker.validate_configuration import ValidateConfig [as 别名]
# 或者: from spinnaker.validate_configuration.ValidateConfig import verify_true_false [as 别名]
def test_true_false_bad(self):
bindings = YamlBindings()
bindings.import_dict(
{'t': 'true', 'f':'false', 'indirect':'${t}', 'default': '${x:0}'})
validator = ValidateConfig(
configurator=Configurator(bindings=bindings))
self.assertFalse(validator.verify_true_false('t'))
self.assertFalse(validator.verify_true_false('f'))
self.assertFalse(validator.verify_true_false('indirect'))
self.assertFalse(validator.verify_true_false('default'))
self.assertEqual(4, len(validator.errors))
self.assertEqual(0, len(validator.warnings))
self.assertEqual(
["t='true' is not valid. Must be boolean true or false.",
"f='false' is not valid. Must be boolean true or false.",
"indirect='true' is not valid. Must be boolean true or false.",
"default=0 is not valid. Must be boolean true or false."],
validator.errors)