@@ -647,6 +647,7 @@ def separate(*_: Any) -> None:
647647 s .step (1 )
648648 s .remove (c1 )
649649
650+ @unittest .skip ("Existing bug in Pymunk. TODO: Fix bug and enable test" )
650651 def testRemoveInSeparate (self ) -> None :
651652 s = p .Space ()
652653 print ("\n XXX start" )
@@ -664,25 +665,31 @@ def testRemoveInSeparate(self) -> None:
664665 shape3 .density = 1
665666 # shape1.collision_type = 3
666667
667- s .add (shape1 ) # , shape2, shape3, body2 , body3)
668+ s .add (shape1 , shape2 , body2 , shape3 , body3 )
668669
669- def remove1 (* _ ) :
670+ def remove1 (* _ : Any ) -> None :
670671 print ("remove1" )
671672 s .remove (shape1 )
672673
673- def remove2 (* _ ) :
674+ def remove2 (* _ : Any ) -> None :
674675 print ("remove2" )
675676 s .remove (shape2 )
676677
677678 # s.add_collision_handler(1, 0).separate = remove2
678- s .step (1 )
679- s .add_wildcard_collision_handler (1 ).separate = remove1
679+ s .add_collision_handler (1 , 0 ).separate = remove1
680680
681- s .remove (shape1 ) # trigger separate with shape2 and shape3
681+ s .step (0.001 )
682+
683+ # trigger separate with shape2 and shape3, shape1 will be removed 2x
684+ s .remove (shape1 )
682685
683- # s.add(shape1)
686+ s .add_collision_handler (1 , 0 ).separate = remove2
687+ s .add (shape1 )
684688
685689 s .step (1 )
690+ # trigger separate with shape2 and shape3, shape1 is removed, and shape2 will be removed
691+ s .remove (shape1 )
692+
686693 # self.assertNotIn(shape1, s.shapes)
687694 # s.remove(shape1)
688695 # s.step(1)
@@ -712,6 +719,7 @@ def separate(*_: Any) -> None:
712719
713720 print (" XXX end" )
714721
722+ @unittest .skip ("Existing bug in Pymunk. TODO: Fix bug and enable test" )
715723 def testCollisionHandlerRemoveAfterSeparate (self ) -> None :
716724 # In this test the separate must happen before post_solve in the same step()
717725 print ()
0 commit comments