Skip to content

Commit 0c38b55

Browse files
committed
ensure unit tests cover all cases within _reduce_force_and_torque
1 parent 3ed442c commit 0c38b55

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎tests/unit/CodeEntropy/levels/test_level_dag_reduce.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,27 @@ def test_reduce_force_and_torque_hits_ua_force_count_increment_line():
182182
dag._reduce_force_and_torque(shared, frame_out)
183183

184184
assert shared["frame_counts"]["ua"][key] == 1
185+
186+
187+
def test_reduce_force_and_torque_ua_torque_increments_count_when_force_missing_key():
188+
dag = LevelDAG()
189+
190+
key = (9, 0)
191+
T = np.eye(3)
192+
193+
shared = {
194+
"force_covariances": {"ua": {}, "res": [None], "poly": [None]},
195+
"torque_covariances": {"ua": {}, "res": [None], "poly": [None]},
196+
"frame_counts": {"ua": {}, "res": [0], "poly": [0]},
197+
"group_id_to_index": {7: 0},
198+
}
199+
200+
frame_out = {
201+
"force": {"ua": {}, "res": {}, "poly": {}},
202+
"torque": {"ua": {key: T}, "res": {}, "poly": {}},
203+
}
204+
205+
dag._reduce_force_and_torque(shared, frame_out)
206+
207+
assert shared["frame_counts"]["ua"][key] == 1
208+
np.testing.assert_array_equal(shared["torque_covariances"]["ua"][key], T)

0 commit comments

Comments
 (0)