mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
PyDoc: include buffer access in examples, cleanup
Note that buffer access is possible, also minor mathutils test cleanup.
This commit is contained in:
parent
e297fb4f14
commit
990f0863e8
6 changed files with 22 additions and 6 deletions
|
|
@ -64,12 +64,18 @@ def _test_flat_buffer_protocol(self, ty, n):
|
|||
|
||||
vec = ty(expected)
|
||||
vec.freeze()
|
||||
view = memoryview(vec)
|
||||
with self.assertRaises(TypeError):
|
||||
view = memoryview(vec)
|
||||
view[0] = 1
|
||||
|
||||
|
||||
class MatrixTesting(unittest.TestCase):
|
||||
|
||||
def assertAlmostEqualMatrix(self, first, second, size, *, places=6, msg=None, delta=None):
|
||||
for i in range(size):
|
||||
for j in range(size):
|
||||
self.assertAlmostEqual(first[i][j], second[i][j], places=places, msg=msg, delta=delta)
|
||||
|
||||
def test_matrix_column_access(self):
|
||||
# mat =
|
||||
# [ 1 2 3 4 ]
|
||||
|
|
@ -302,11 +308,6 @@ class MatrixTesting(unittest.TestCase):
|
|||
self.assertEqual(view.format, "f")
|
||||
self.assertEqual(view.tolist(), expected)
|
||||
|
||||
def assertAlmostEqualMatrix(self, first, second, size, *, places=6, msg=None, delta=None):
|
||||
for i in range(size):
|
||||
for j in range(size):
|
||||
self.assertAlmostEqual(first[i][j], second[i][j], places=places, msg=msg, delta=delta)
|
||||
|
||||
|
||||
class VectorTesting(unittest.TestCase):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue