1 import unittest 2 from ctypes import * 3 4 class X(Structure): 5 _fields_ = [("foo", c_int)] 6 7 class TestCase(unittest.TestCase): 8 def test_simple(self): 9 self.assertRaises(TypeError, 10 delattr, c_int(42), "value") 11 12 def test_chararray(self): 13 self.assertRaises(TypeError, 14 delattr, (c_char * 5)(), "value") 15 16 def test_struct(self): 17 self.assertRaises(TypeError, 18 delattr, X(), "foo") 19 20 if __name__ == "__main__": 21 unittest.main() 22