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

Function test_matrix_set_size

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

Source from the content-addressed store, hash-verified

83
84
85def test_matrix_set_size():
86 m = matrix()
87 m.set_size(5, 5)
88
89 assert m.nr() == 5
90 assert m.nc() == 5
91 assert m.shape == (5, 5)
92 assert len(m) == 5
93 assert repr(m) == "< dlib.matrix containing: \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 >"
94 assert str(m) == "0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0 \n0 0 0 0 0"
95
96 deser = pickle.loads(pickle.dumps(m, 2))
97
98 for row in range(5):
99 for col in range(5):
100 assert m[row][col] == deser[row][col]

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected