MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / test_assembly

Function test_assembly

tests/test_inferenceutils.py:106–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104
105
106def test_assembly():
107 ass = inferenceutils.Assembly(3)
108 assert len(ass) == 0
109
110 j1 = inferenceutils.Joint((1, 1), label=0)
111 j2 = inferenceutils.Joint((1, 1), label=1)
112 assert ass.add_link(inferenceutils.Link(j1, j2), store_dict=True)
113 assert len(ass) == 2
114 assert ass.data[j2.label, 0] == 1
115 assert ass.data[j2.label, -1] == -1
116 assert ass.area == 0
117 assert ass.intersection_with(ass) == 1.0
118 # Original (cached) coordinates must have remained empty
119 assert np.all(np.isnan(ass._dict["data"][:, :2]))
120
121 ass.remove_joint(j2)
122 assert len(ass) == 1
123 assert np.all(np.isnan(ass.data[j2.label]))
124
125 ass2 = inferenceutils.Assembly(2)
126 ass2.add_link(inferenceutils.Link(j1, j2))
127 with pytest.raises(ValueError):
128 _ = ass + ass2
129 ass2.remove_joint(j1)
130 assert ass2 not in ass
131 ass3 = ass + ass2
132 assert len(ass3) == 2
133
134
135def test_assembler(tmpdir_factory, real_assemblies):

Callers

nothing calls this directly

Calls 3

add_linkMethod · 0.95
intersection_withMethod · 0.95
remove_jointMethod · 0.95

Tested by

no test coverage detected