SHARE
TWEET

Untitled

a guest Dec 10th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top