test_ode_joints.py 847 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import pytest
  2. def test_odejoint_attach_both(world):
  3. from panda3d import ode
  4. body1 = ode.OdeBody(world)
  5. body2 = ode.OdeBody(world)
  6. assert len(body1.joints) == 0
  7. assert len(body2.joints) == 0
  8. joint = ode.OdeBallJoint(world)
  9. joint.attach(body1, body2)
  10. assert tuple(body1.joints) == (joint,)
  11. assert tuple(body2.joints) == (joint,)
  12. def test_odejoint_attach_0(world):
  13. from panda3d import ode
  14. body = ode.OdeBody(world)
  15. assert len(body.joints) == 0
  16. joint = ode.OdeBallJoint(world)
  17. joint.attach(body, None)
  18. assert tuple(body.joints) == (joint,)
  19. def test_odejoint_attach_1(world):
  20. from panda3d import ode
  21. body = ode.OdeBody(world)
  22. assert len(body.joints) == 0
  23. joint = ode.OdeBallJoint(world)
  24. joint.attach(None, body)
  25. assert tuple(body.joints) == (joint,)