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


Python Leaf.valid_value_types方法代码示例

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


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

示例1: test_validation_mixed_invalid_allowedvalue_butwrongtype

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_validation_mixed_invalid_allowedvalue_butwrongtype():
    leaf = Leaf()
    x = random.randrange(100)
    leaf.valid_value_types = float
    leaf.allowed_values = [x]
    leaf.value = x
    assert not leaf.is_valid(settings)
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:9,代码来源:test_leaf.py

示例2: test_set_valid_value_types_one_type

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_set_valid_value_types_one_type():
    leaf = Leaf()
    x = int
    leaf.valid_value_types = x
    out = leaf.valid_value_types
    assert isinstance(out, collections.Iterable)
    assert len(out) == 1
    assert x == out[0]
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:10,代码来源:test_leaf.py

示例3: test_set_valid_value_types_many_types

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_set_valid_value_types_many_types():
    leaf = Leaf()
    x = (int, float, type(None))
    leaf.valid_value_types = x
    out = leaf.valid_value_types
    assert isinstance(out, collections.Iterable)
    assert len(x) == len(out)
    for i, v in enumerate(x):
        assert v == out[i]
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:11,代码来源:test_leaf.py

示例4: test_undo_valid_value_types

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_undo_valid_value_types():
    leaf = Leaf(valid_value_types=int)
    assert leaf.valid_value_types is not None
    x = None
    leaf.valid_value_types = x
    assert x == leaf.valid_value_types
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:8,代码来源:test_leaf.py

示例5: test_set_valid_value_types_list_with_one_invalid

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_set_valid_value_types_list_with_one_invalid():
    leaf = Leaf()
    x = [int, 'av', float, bytes]
    leaf.valid_value_types = x
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:6,代码来源:test_leaf.py

示例6: test_set_valid_value_types_one_invalid

# 需要导入模块: from SettingsTree import Leaf [as 别名]
# 或者: from SettingsTree.Leaf import valid_value_types [as 别名]
def test_set_valid_value_types_one_invalid():
    leaf = Leaf()
    x = 3
    leaf.valid_value_types = x
开发者ID:frejanordsiek,项目名称:SettingsTree,代码行数:6,代码来源:test_leaf.py


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