當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。