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

Function test_matrix_from_list

tools/python/test/test_matrix.py:25–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24
25def test_matrix_from_list():
26 m = matrix([[0, 1, 2],
27 [3, 4, 5],
28 [6, 7, 8]])
29 assert m.nr() == 3
30 assert m.nc() == 3
31 assert m.shape == (3, 3)
32 assert len(m) == 3
33 assert repr(m) == "< dlib.matrix containing: \n0 1 2 \n3 4 5 \n6 7 8 >"
34 assert str(m) == "0 1 2 \n3 4 5 \n6 7 8"
35
36 deser = pickle.loads(pickle.dumps(m, 2))
37
38 for row in range(3):
39 for col in range(3):
40 assert m[row][col] == deser[row][col]
41
42
43def test_matrix_from_list_with_invalid_rows():

Callers

nothing calls this directly

Calls 7

matrixClass · 0.90
lenFunction · 0.85
reprFunction · 0.85
strClass · 0.85
rangeFunction · 0.50
nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected