MCPcopy Create free account
hub / github.com/grantjenks/python-sortedcontainers / test_valuesview

Function test_valuesview

tests/test_coverage_sorteddict.py:400–421  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398 assert repr(keys) == "SortedKeysView(SortedDict({'a': 0, 'b': 1}))"
399
400def test_valuesview():
401 mapping = [(val, pos) for pos, val in enumerate(string.ascii_lowercase)]
402 temp = SortedDict(mapping[:13])
403 values = temp.values()
404
405 assert len(values) == 13
406 assert 0 in values
407 assert list(values) == [pos for val, pos in mapping[:13]]
408 assert values[0] == 0
409 assert values[-3:] == [10, 11, 12]
410 assert list(reversed(values)) == list(reversed(range(13)))
411 assert values.index(5) == 5
412 assert values.count(10) == 1
413
414 temp.update(mapping[13:])
415
416 assert len(values) == 26
417 assert 25 in values
418 assert list(values) == [pos for val, pos in mapping]
419
420 values = SortedDict(mapping[:2]).values()
421 assert repr(values) == "SortedValuesView(SortedDict({'a': 0, 'b': 1}))"
422
423def test_values_view_index():
424 mapping = [(val, pos) for pos, val in enumerate(string.ascii_lowercase)]

Callers

nothing calls this directly

Calls 5

valuesMethod · 0.95
updateMethod · 0.95
SortedDictClass · 0.90
indexMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected