Skip to content

Commit ef33aa6

Browse files
committed
Polish of updated batch
1 parent 49c6724 commit ef33aa6

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

pymunk/batch.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
]
7575

7676
from enum import Flag
77+
from typing import Any
7778

7879
from ._chipmunk_cffi import ffi, lib
7980
from .space import Space
@@ -167,7 +168,7 @@ def float_buf(self) -> ffi.buffer:
167168
self._float_arr.arr, ffi.sizeof("cpFloat") * self._float_arr.num
168169
)
169170

170-
def set_float_buf(self, buffer) -> None:
171+
def set_float_buf(self, buffer: Any) -> None:
171172
"""Set the floating point internal data to the supplied buffer.
172173
173174
buffer should be an array of floats, implmenting the buffer/memoryview
@@ -192,7 +193,7 @@ def int_buf(self) -> ffi.buffer:
192193
self._int_arr.arr, ffi.sizeof("uintptr_t") * self._int_arr.num
193194
)
194195

195-
def set_int_buf(self, buffer) -> None:
196+
def set_int_buf(self, buffer: Any) -> None:
196197
"""Set the integer internal data to the supplied buffer.
197198
198199
buffer should be an array of ints, implmenting the buffer/memoryview

pymunk/tests/test_batch.py

+1-23
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
class UnitTestBatch(unittest.TestCase):
99

1010
def test_buffer(self) -> None:
11-
print()
1211
b = pymunk.batch.Buffer()
1312
arr = array.array("d", [1.2, 3.4])
1413
b.set_float_buf(arr)
@@ -161,27 +160,6 @@ def test_set_bodies(self) -> None:
161160

162161
self.assertEqual(list(memoryview(data.float_buf()).cast("d")), v)
163162

164-
def test_set_get_bodies(self) -> None:
165-
s = pymunk.Space()
166-
167-
b1 = pymunk.Body(1, 1)
168-
s.add(b1, pymunk.Circle(b1, 4))
169-
170-
b2 = pymunk.Body(1, 1)
171-
s.add(b2, pymunk.Circle(b2, 4))
172-
173-
data = pymunk.batch.Buffer()
174-
angle_arr = array.array("d", [3, 4, 5, 6, 7, 8])
175-
data.set_float_buf(angle_arr)
176-
pymunk.batch.set_space_bodies(
177-
s, pymunk.batch.BodyFields.POSITION | pymunk.batch.BodyFields.ANGLE, data
178-
)
179-
180-
data = pymunk.batch.Buffer()
181-
pymunk.batch.get_space_bodies(
182-
s, pymunk.batch.BodyFields.POSITION | pymunk.batch.BodyFields.ANGLE, data
183-
)
184-
185163
def test_get_arbiters(self) -> None:
186164
s = pymunk.Space()
187165

@@ -275,7 +253,7 @@ def check_arb_data(arb: pymunk.Arbiter) -> None:
275253
b2.each_arbiter(check_arb_data)
276254
b3.each_arbiter(check_arb_data)
277255

278-
def test_get_arbiter_sensor(self):
256+
def test_get_arbiter_sensor(self) -> None:
279257
s = pymunk.Space()
280258

281259
b1 = pymunk.Body(1, 1)

0 commit comments

Comments
 (0)