summaryrefslogtreecommitdiff
path: root/lib/python2.7/ctypes/test/test_delattr.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/ctypes/test/test_delattr.py')
-rw-r--r--lib/python2.7/ctypes/test/test_delattr.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/python2.7/ctypes/test/test_delattr.py b/lib/python2.7/ctypes/test/test_delattr.py
new file mode 100644
index 0000000..0f4d586
--- /dev/null
+++ b/lib/python2.7/ctypes/test/test_delattr.py
@@ -0,0 +1,21 @@
+import unittest
+from ctypes import *
+
+class X(Structure):
+ _fields_ = [("foo", c_int)]
+
+class TestCase(unittest.TestCase):
+ def test_simple(self):
+ self.assertRaises(TypeError,
+ delattr, c_int(42), "value")
+
+ def test_chararray(self):
+ self.assertRaises(TypeError,
+ delattr, (c_char * 5)(), "value")
+
+ def test_struct(self):
+ self.assertRaises(TypeError,
+ delattr, X(), "foo")
+
+if __name__ == "__main__":
+ unittest.main()