本文整理匯總了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()
示例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()
示例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()
示例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()
示例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
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()
示例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()