Skip to content

Commit 25cdf18

Browse files
author
David Butterworth
committed
Modify Unit Test CheckJointLimits_MinLimitOneJoint to test all joints, and to use assertRaises()
1 parent e64e105 commit 25cdf18

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

tests/test_util.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,12 @@ def test_ComputeUnitTiming(self):
189189
# [ 2.617, 1.972, 2.740, 3.141, 1.308, 1.570, 3.001]
190190

191191
def test_CheckJointLimits_MinLimitOneJoint(self):
192-
# One joint is beyond the min limit
193-
q0 = [0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0]
194-
try:
195-
prpy.util.CheckJointLimits(self.robot, q0)
196-
except JointLimitError:
197-
pass # test passed
198-
except Exception, e:
199-
error = 'Unexpected exception thrown: ' + str(e.message)
200-
self.fail(error)
201-
else:
202-
self.fail('Expected exception not thrown')
192+
# Individually check for when one joint is beyond the min limit
193+
for i in xrange(0,7):
194+
q = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
195+
q[i] = -5.0
196+
with self.assertRaises(JointLimitError):
197+
prpy.util.CheckJointLimits(self.robot, q)
203198

204199
def test_CheckJointLimits_MinLimitAll(self):
205200
# This configuration is beyond the min limits

0 commit comments

Comments
 (0)