MCPcopy Create free account
hub / github.com/davisking/dlib / test_vector_slice

Function test_vector_slice

tools/python/test/test_vector.py:54–69  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52
53
54def test_vector_slice():
55 v = vector([1, 2, 3, 4, 5])
56 v_slice = v[1:4]
57 assert len(v_slice) == 3
58 for idx, val in enumerate([2, 3, 4]):
59 assert v_slice[idx] == val
60
61 v_slice = v[-3:-1]
62 assert len(v_slice) == 2
63 for idx, val in enumerate([3, 4]):
64 assert v_slice[idx] == val
65
66 v_slice = v[1:-2]
67 assert len(v_slice) == 2
68 for idx, val in enumerate([2, 3]):
69 assert v_slice[idx] == val
70
71
72def test_vector_invalid_getitem():

Callers

nothing calls this directly

Calls 2

vectorClass · 0.90
lenFunction · 0.85

Tested by

no test coverage detected