Guest User

Untitled

a guest
Dec 10th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. from ctypes import Structure, c_int16
  2.  
  3. def test_struct_format():
  4. class Struct(Structure):
  5. _fields_ = [('a', c_int16)]
  6.  
  7. Struct3 = 3 * Struct
  8.  
  9. c_array = (2 * Struct3)(
  10. Struct3(Struct(a=1), Struct(a=2), Struct(a=3)),
  11. Struct3(Struct(a=4), Struct(a=5), Struct(a=6))
  12. )
  13.  
  14. mv = memoryview(c_array)
  15. assert mv.format == 'T{<h:a:}', '%s != "T{<h:a:}"' % mv.format
  16.  
  17. test_struct_format()
Add Comment
Please, Sign In to add comment