Back to index

python3.2  3.2.2
Public Member Functions
ctypes.test.test_strings.WStringTestCase Class Reference

def test_perf(self): check_perf() More...

List of all members.

Public Member Functions

def test_wchar
def X_test_basic_wstrings
def X_test_toolong

Detailed Description

def test_perf(self): check_perf()

Definition at line 153 of file test_strings.py.


Member Function Documentation

Definition at line 154 of file test_strings.py.

00154 
00155         def test_wchar(self):
00156             c_wchar("x")
00157             repr(byref(c_wchar("x")))
00158             c_wchar("x")
00159 

Here is the call graph for this function:

Definition at line 160 of file test_strings.py.

00160 
00161         def X_test_basic_wstrings(self):
00162             cs = c_wstring("abcdef")
00163 
00164             # XXX This behaviour is about to change:
00165             # len returns the size of the internal buffer in bytes.
00166             # This includes the terminating NUL character.
00167             self.assertTrue(sizeof(cs) == 14)
00168 
00169             # The value property is the string up to the first terminating NUL.
00170             self.assertTrue(cs.value == "abcdef")
00171             self.assertTrue(c_wstring("abc\000def").value == "abc")
00172 
00173             self.assertTrue(c_wstring("abc\000def").value == "abc")
00174 
00175             # The raw property is the total buffer contents:
00176             self.assertTrue(cs.raw == "abcdef\000")
00177             self.assertTrue(c_wstring("abc\000def").raw == "abc\000def\000")
00178 
00179             # We can change the value:
00180             cs.value = "ab"
00181             self.assertTrue(cs.value == "ab")
00182             self.assertTrue(cs.raw == "ab\000\000\000\000\000")
00183 
00184             self.assertRaises(TypeError, c_wstring, "123")
00185             self.assertRaises(ValueError, c_wstring, 0)

Here is the call graph for this function:

Definition at line 186 of file test_strings.py.

00186 
00187         def X_test_toolong(self):
00188             cs = c_wstring("abcdef")
00189             # Much too long string:
00190             self.assertRaises(ValueError, setattr, cs, "value", "123456789012345")
00191 
00192             # One char too long values:
00193             self.assertRaises(ValueError, setattr, cs, "value", "1234567")
00194 

Here is the call graph for this function:


The documentation for this class was generated from the following file: