PageRenderTime 16ms CodeModel.GetById 7ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/Lib/ctypes/test/test_delattr.py

http://unladen-swallow.googlecode.com/
Python | 21 lines | 16 code | 5 blank | 0 comment | 1 complexity | 19368b70aa66df664ae50109d42269cc MD5 | raw file
 1import unittest
 2from ctypes import *
 3
 4class X(Structure):
 5    _fields_ = [("foo", c_int)]
 6
 7class 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
20if __name__ == "__main__":
21    unittest.main()