MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_unicode

Method test_unicode

Lib/test/test_array.py:1225–1243  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1223 minitemsize = sizeof_wchar
1224
1225 def test_unicode(self):
1226 self.assertRaises(TypeError, array.array, 'b', 'foo')
1227
1228 a = array.array(self.typecode, '\xa0\xc2\u1234')
1229 a.fromunicode(' ')
1230 a.fromunicode('')
1231 a.fromunicode('')
1232 a.fromunicode('\x11abc\xff\u1234')
1233 s = a.tounicode()
1234 self.assertEqual(s, '\xa0\xc2\u1234 \x11abc\xff\u1234')
1235 self.assertEqual(a.itemsize, self.minitemsize)
1236
1237 s = '\x00="\'a\\b\x80\xff\u0000\u0001\u1234'
1238 a = array.array(self.typecode, s)
1239 self.assertEqual(
1240 repr(a),
1241 f"array('{self.typecode}', '\\x00=\"\\'a\\\\b\\x80\xff\\x00\\x01\u1234')")
1242
1243 self.assertRaises(TypeError, a.fromunicode)
1244
1245 def test_issue17223(self):
1246 if self.typecode == 'u' and sizeof_wchar == 2:

Callers

nothing calls this directly

Calls 5

reprFunction · 0.85
fromunicodeMethod · 0.80
tounicodeMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected