本文整理匯總了Python中SettingsTree.Leaf.forbidden_values方法的典型用法代碼示例。如果您正苦於以下問題:Python Leaf.forbidden_values方法的具體用法?Python Leaf.forbidden_values怎麽用?Python Leaf.forbidden_values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SettingsTree.Leaf
的用法示例。
在下文中一共展示了Leaf.forbidden_values方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_validation_mixed_invalid_alwaystrue_butforbidden
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_validation_mixed_invalid_alwaystrue_butforbidden():
leaf = Leaf()
x = random.random()
leaf.validator_function = lambda x, y: True
leaf.forbidden_values = [x]
leaf.value = x
assert not leaf.is_valid(settings)
示例2: test_validation_forbidden_values_valid
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_validation_forbidden_values_valid():
leaf = Leaf()
x = [random.random() for i in range(5, 10)]
leaf.forbidden_values = x
y = x[0]
while y in x:
y = random.random()
leaf.value = y
assert leaf.is_valid(settings)
示例3: test_set_forbidden_values
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_set_forbidden_values():
leaf = Leaf()
x = [random.random() for i in range(random.randint(4, 30))]
leaf.forbidden_values = x
out = leaf.forbidden_values
assert isinstance(out, collections.Iterable)
assert len(x) == len(out)
for i, v in enumerate(x):
assert v == out[i]
示例4: test_validation_forbidden_values_invalid
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_validation_forbidden_values_invalid():
leaf = Leaf()
x = [random.random() for i in range(5, 10)]
leaf.forbidden_values = x
leaf.value = x[random.randrange(len(x))]
assert not leaf.is_valid(settings)
示例5: test_set_forbidden_values_invalid_noniterable
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_set_forbidden_values_invalid_noniterable():
leaf = Leaf()
x = 9
leaf.forbidden_values = x
示例6: test_undo_forbidden_values
# 需要導入模塊: from SettingsTree import Leaf [as 別名]
# 或者: from SettingsTree.Leaf import forbidden_values [as 別名]
def test_undo_forbidden_values():
leaf = Leaf(forbidden_values=(3,))
assert leaf.forbidden_values is not None
x = None
leaf.forbidden_values = x
assert x == leaf.forbidden_values