MCPcopy Create free account
hub / github.com/Kitware/VTK / testUnicode

Method testUnicode

Wrapping/Python/Testing/Python/TestChar.py:20–35  ·  view source on GitHub ↗

Pass a unicode string and get it back.

(self)

Source from the content-addressed store, hash-verified

18
19class TestChar(Testing.vtkTest):
20 def testUnicode(self):
21 """Pass a unicode string and get it back.
22 """
23 a = vtkCharArray()
24 a.InsertNextValue('\0')
25 a.InsertNextValue('%')
26 a.InsertNextValue('\u00b5') # MICRON
27 a.InsertNextValue('\u00d7') # MULTIPLICATION SIGN
28 c = a.GetValue(0)
29 self.assertEqual(c, '\0')
30 c = a.GetValue(1)
31 self.assertEqual(c, '%')
32 c = a.GetValue(2)
33 self.assertEqual(c, '\u00b5')
34 c = a.GetValue(3)
35 self.assertEqual(c, '\u00d7')
36
37 def testBytes(self):
38 """Pass a bytes object, get back a unicode object

Callers

nothing calls this directly

Calls 3

vtkCharArrayClass · 0.50
InsertNextValueMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected