MCPcopy Create free account
hub / github.com/Kitware/VTK / testBitArray

Method testBitArray

Common/Core/Testing/Python/TestBuffer.py:101–115  ·  view source on GitHub ↗

Test the special case of the bit array.

(self)

Source from the content-addressed store, hash-verified

99 self.assertEqual(m.tobytes(), b"helloworld")
100
101 def testBitArray(self):
102 """Test the special case of the bit array."""
103 # bit array is actually stored as a byte array
104 a = vtkBitArray()
105 a.InsertNextValue(0)
106 a.InsertNextValue(1)
107 a.InsertNextValue(1)
108 a.InsertNextValue(0)
109 a.InsertNextValue(1)
110 m = memoryview(a)
111 self.assertEqual(m.format, 'B')
112 self.assertEqual(m.itemsize, 1)
113 self.assertEqual(m.shape, (1,))
114 # test the contents of the memoryview
115 self.assertEqual(ord(m.tobytes()) & 0xF8, 0x68)
116
117 def testBufferShared(self):
118 """Test the special buffer_shared() check that VTK provides."""

Callers

nothing calls this directly

Calls 2

vtkBitArrayFunction · 0.50
InsertNextValueMethod · 0.45

Tested by

no test coverage detected