File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -660,7 +660,7 @@ def add_post_step_callback(
660
660
self ,
661
661
callback_function : Callable [
662
662
..., None
663
- ], # TODO: Fix me once PEP-612 is implemented
663
+ ], # TODO: Fix me once PEP-612 is implemented (py 3.10)
664
664
key : Hashable ,
665
665
* args : Any ,
666
666
** kwargs : Any ,
Original file line number Diff line number Diff line change @@ -171,6 +171,35 @@ def test_static(self) -> None:
171
171
b = p .Body (body_type = p .Body .STATIC )
172
172
self .assertEqual (b .body_type , p .Body .STATIC )
173
173
174
+ def test_mass (self ) -> None :
175
+ s = p .Space ()
176
+ b = p .Body ()
177
+
178
+ b .mass = 2
179
+ s .add (b )
180
+
181
+ # Cant set 0 mass on Body in Space
182
+ with self .assertRaises (AssertionError ):
183
+ b .mass = 0
184
+
185
+ s .remove (b )
186
+ b .mass = 0
187
+ s .add (b )
188
+ # Cant add 0 mass Body to Space and run step
189
+ with self .assertRaises (AssertionError ):
190
+ s .step (1 )
191
+
192
+ c = p .Circle (b , 1 )
193
+ s .add (c )
194
+
195
+ # Same with a Shape
196
+ with self .assertRaises (AssertionError ):
197
+ s .step (1 )
198
+
199
+ # Setting the Shape mass or density should fix it
200
+ c .density = 10
201
+ s .step (1 )
202
+
174
203
def test_mass_moment_from_shape (self ) -> None :
175
204
s = p .Space ()
176
205
You can’t perform that action at this time.
0 commit comments