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


Python PriorityDict._check方法代码示例

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


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

示例1: test_isub_small

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_isub_small():
    temp = PriorityDict((val, val) for val in range(100))
    that = PriorityDict((val, val) for val in range(10))
    temp -= that
    assert all(temp[val] == 0 for val in range(10))
    assert all(temp[val] == val for val in range(10, 100))
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:9,代码来源:test_coverage.py

示例2: test_iloc_delitem_slice

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_iloc_delitem_slice():
    temp = PriorityDict(enumerate(string.lowercase))
    that = list(enumerate(string.lowercase))
    del temp.iloc[5:20:3]
    del that[5:20:3]
    assert temp.items() == that
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:9,代码来源:test_coverage.py

示例3: test_len

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_len():
    temp = PriorityDict()
    assert len(temp) == 0
    val = dict((letter, pos) for pos, letter in enumerate(string.lowercase))
    temp.update(val)
    assert len(temp) == 26
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:9,代码来源:test_coverage.py

示例4: test_setdefault

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_setdefault():
    temp = PriorityDict((val, key) for key, val in enumerate(string.lowercase))
    assert temp.setdefault('d', -1) == 3
    assert temp.setdefault('blah', 10) == 10
    temp._check()
    assert len(temp) == 27
    assert temp['k'] == 10
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:10,代码来源:test_coverage.py

示例5: test_clean

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_clean():
    temp = PriorityDict((val, num) for num, val in enumerate(string.lowercase))
    assert len(temp) == 26
    temp.clean()
    temp._check()
    assert len(temp) == 25
    temp.clean(10)
    temp._check()
    assert len(temp) == 15
开发者ID:grantjenks,项目名称:prioritydict,代码行数:11,代码来源:test_coverage.py

示例6: test_iand_big

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_iand_big():
    temp_vals = list((val, rand(100)) for val in range(100))
    that_vals = list((val, rand(100)) for val in range(100))
    temp = PriorityDict(temp_vals)
    that = PriorityDict(that_vals)
    temp &= that
    assert all(temp[pos] == min(temp_vals[pos][1], that_vals[pos][1])
               for pos in range(100))
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:11,代码来源:test_coverage.py

示例7: test_iloc_delitem

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_iloc_delitem():
    temp = PriorityDict(enumerate(string.lowercase))
    that = list(enumerate(string.lowercase))

    while len(temp) > 0:
        pos = rand(len(temp))
        del that[pos]
        del temp.iloc[pos]
        assert temp.items() == that
        temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:12,代码来源:test_coverage.py

示例8: test_ior_small

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_ior_small():
    temp_vals = list((val, rand(100)) for val in range(100))
    that_vals = list((val, rand(100)) for val in range(10))
    temp = PriorityDict(temp_vals)
    that = PriorityDict(that_vals)
    temp |= that
    assert all(temp[pos] == max(temp_vals[pos][1], that_vals[pos][1])
               for pos in range(10))
    assert all(temp[pos] == temp_vals[pos][1]
               for pos in range(10, 100))
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:13,代码来源:test_coverage.py

示例9: test_iter

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_iter():
    temp = PriorityDict((val, key) for key, val in enumerate(string.lowercase))
    assert list(iter(temp)) == list(string.lowercase)
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:6,代码来源:test_coverage.py

示例10: test_get

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_get():
    temp = PriorityDict((val, key) for key, val in enumerate(string.lowercase))
    assert temp.get('a') == 0
    assert temp.get('y') == 24
    assert temp.get('blah') == None
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:8,代码来源:test_coverage.py

示例11: test_iloc_getitem

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_iloc_getitem():
    temp = PriorityDict(enumerate(string.lowercase))
    for pos, letter in enumerate(string.lowercase):
        assert temp[temp.iloc[pos]] == letter
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:7,代码来源:test_coverage.py

示例12: test_delitem

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_delitem():
    temp = PriorityDict(enumerate(string.lowercase))
    del temp[13]
    assert len(temp) == 25
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:7,代码来源:test_coverage.py

示例13: test_contains

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_contains():
    temp = PriorityDict(enumerate(string.lowercase))
    assert all(pos in temp for pos in range(len(string.lowercase)))
    assert 26 not in temp
    assert not (-1 in temp)
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:8,代码来源:test_coverage.py

示例14: test_has_key

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_has_key():
    temp = PriorityDict((val, key) for key, val in enumerate(string.lowercase))
    assert temp.has_key('r')
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:6,代码来源:test_coverage.py

示例15: test_reversed

# 需要导入模块: from prioritydict import PriorityDict [as 别名]
# 或者: from prioritydict.PriorityDict import _check [as 别名]
def test_reversed():
    temp = PriorityDict((val, key) for key, val in enumerate(string.lowercase))
    assert list(reversed(temp)) == list(reversed(string.lowercase))
    temp._check()
开发者ID:grantjenks,项目名称:prioritydict,代码行数:6,代码来源:test_coverage.py


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